diff options
author | usodhi <61431818+usodhi@users.noreply.github.com> | 2021-02-11 16:43:46 -0500 |
---|---|---|
committer | usodhi <61431818+usodhi@users.noreply.github.com> | 2021-02-11 16:43:46 -0500 |
commit | 546540013de0a7cb647f30f1fcb513ce52048b72 (patch) | |
tree | 12b78ea0e29fba23b8557864540984daf9680942 /src/client/views/nodes/DocumentContentsView.tsx | |
parent | 77b7c3927c454a829d7dbb2748ad322b146265a7 (diff) | |
parent | 890337b525ea460f9986562c047135bc5ca203a6 (diff) |
merging
Diffstat (limited to 'src/client/views/nodes/DocumentContentsView.tsx')
-rw-r--r-- | src/client/views/nodes/DocumentContentsView.tsx | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/client/views/nodes/DocumentContentsView.tsx b/src/client/views/nodes/DocumentContentsView.tsx index f969bee85..4b4720d58 100644 --- a/src/client/views/nodes/DocumentContentsView.tsx +++ b/src/client/views/nodes/DocumentContentsView.tsx @@ -111,7 +111,6 @@ export class DocumentContentsView extends React.Component<DocumentViewProps & Fo scaling?: () => number, layoutKey: string, hideOnLeave?: boolean, - makeLink?: () => Opt<Doc>, // function to call when a link is made }> { @computed get layout(): string { TraceMobx(); @@ -141,16 +140,17 @@ export class DocumentContentsView extends React.Component<DocumentViewProps & Fo CreateBindings(onClick: Opt<ScriptField>, onInput: Opt<ScriptField>): JsxBindings { const docOnlyProps = [ // these are the properties in DocumentViewProps that need to be removed to pass on only DocumentSharedViewProps to the FieldViews "freezeDimensions", + "hideResizeHandles", "hideTitle", "treeViewDoc", - "dragDivName", "contentPointerEvents", "radialMenu", "LayoutTemplateString", "LayoutTemplate", + "dontCenter", "ContentScaling", - "contentFittingScaling", "contextMenuItems", + "onClick", "onDoubleClick", "onPointerDown", "onPointerUp", @@ -166,7 +166,11 @@ export class DocumentContentsView extends React.Component<DocumentViewProps & Fo return { props: list }; } - render() { + componentWillUpdate(oldProps: any, newState: any) { + // console.log("willupdate", oldProps, this.props); // bcz: if you get a message saying something invalidated because reactive props changed, then this method allows you to figure out which prop changed + } + + @computed get renderData() { TraceMobx(); let layoutFrame = this.layout; @@ -201,13 +205,18 @@ export class DocumentContentsView extends React.Component<DocumentViewProps & Fo }; const onClick = makeFuncProp("onClick"); const onInput = makeFuncProp("onInput"); - const bindings = this.CreateBindings(onClick, onInput); - // layoutFrame = splits.length > 1 ? splits[0] + splits[1].replace(/{([^{}]|(?R))*}/, replacer4) : ""; // might have been more elegant if javascript supported recursive patterns + return { bindings, layoutFrame }; + } + + render() { + TraceMobx(); + const { bindings, layoutFrame } = this.renderData; + return (this.props.renderDepth > 12 || !layoutFrame || !this.layoutDoc || GetEffectiveAcl(this.layoutDoc) === AclPrivate) ? (null) : <ObserverJsxParser key={42} - blacklistedAttrs={[]} + blacklistedAttrs={emptyPath} renderInWrapper={false} components={{ FormattedTextBox, ImageBox, DirectoryImportBox, FontIconBox, LabelBox, SliderBox, FieldView, |