diff options
| author | bobzel <zzzman@gmail.com> | 2021-08-09 14:26:14 -0400 | 
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2021-08-09 14:26:14 -0400 | 
| commit | 81ae5175aebf7e14a781a73d4a7cbaec0b8f3e4a (patch) | |
| tree | bf6a46eaa3899048e13e28a99f375b3a0c34bd8a /src/client/views/nodes/formattedText/FormattedTextBox.tsx | |
| parent | 8480bcbe9e5ddea4bac64273c2e6581d36bb49de (diff) | |
fixed augment only text to resize correctly with autoheight. fixed acls to cache correctly for new documents. fixed links to be shared across users.  fixed links to always default to public.
Diffstat (limited to 'src/client/views/nodes/formattedText/FormattedTextBox.tsx')
| -rw-r--r-- | src/client/views/nodes/formattedText/FormattedTextBox.tsx | 20 | 
1 files changed, 12 insertions, 8 deletions
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx index f7bed2fa1..9bba15b28 100644 --- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx +++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx @@ -431,6 +431,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp          this.ProseRef = ele;          this._dropDisposer?.();          ele && (this._dropDisposer = DragManager.MakeDropTarget(ele, this.drop.bind(this), this.layoutDoc)); +        // if (this.autoHeight) this.tryUpdateScrollHeight();       }      @undoBatch @@ -1438,16 +1439,19 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp              }          }      } -    tryUpdateScrollHeight() { +    tryUpdateScrollHeight = () => {          if (!LightboxView.LightboxDoc || LightboxView.IsLightboxDocView(this.props.docViewPath())) {              const margins = 2 * NumCast(this.layoutDoc._yMargin, this.props.yPadding || 0); -            const proseHeight = !this.ProseRef ? 0 : Array.from(this.ProseRef.children[0].children).reduce((p, child) => p + Number(getComputedStyle(child).height.replace("px", "")), margins); -            const scrollHeight = this.ProseRef && Math.min(NumCast(this.layoutDoc.docMaxAutoHeight, proseHeight), proseHeight); -            if (scrollHeight && this.props.renderDepth && !this.props.dontRegisterView) {  // if top === 0, then the text box is growing upward (as the overlay caption) which doesn't contribute to the height computation -                const setScrollHeight = () => this.rootDoc[this.fieldKey + "-scrollHeight"] = scrollHeight; -                if (this.rootDoc === this.layoutDoc.doc || this.layoutDoc.resolvedDataDoc) { -                    setScrollHeight(); -                } else setTimeout(setScrollHeight, 10); // if we have a template that hasn't been resolved yet, we can't set the height or we'd be setting it on the unresolved template.  So set a timeout and hope its arrived... +            const children = this.ProseRef?.children.length ? Array.from(this.ProseRef.children[0].children) : undefined; +            if (children) { +                const proseHeight = !this.ProseRef ? 0 : children.reduce((p, child) => p + Number(getComputedStyle(child).height.replace("px", "")), margins); +                const scrollHeight = this.ProseRef && Math.min(NumCast(this.layoutDoc.docMaxAutoHeight, proseHeight), proseHeight); +                if (scrollHeight && this.props.renderDepth && !this.props.dontRegisterView) {  // if top === 0, then the text box is growing upward (as the overlay caption) which doesn't contribute to the height computation +                    const setScrollHeight = () => this.rootDoc[this.fieldKey + "-scrollHeight"] = scrollHeight; +                    if (this.rootDoc === this.layoutDoc.doc || this.layoutDoc.resolvedDataDoc) { +                        setScrollHeight(); +                    } else setTimeout(setScrollHeight, 10); // if we have a template that hasn't been resolved yet, we can't set the height or we'd be setting it on the unresolved template.  So set a timeout and hope its arrived... +                }              }          }      }  | 
