diff options
author | bobzel <zzzman@gmail.com> | 2020-10-05 09:36:13 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2020-10-05 09:36:13 -0400 |
commit | b725cbb244136ddfffad24d4ac68b9beb31845a3 (patch) | |
tree | 3454b151cf9aea7feec9fc3d1d95f08da5f0b2b8 /src/client/views/nodes/formattedText/FormattedTextBox.tsx | |
parent | 8e14d42c61efb0ee5547fbcb7ec9131a7f0ff74f (diff) |
stopped ctrl-a from selecting doucment.body. prevented pdfviewer's texxt layer from scrolling horizontally when text annotations go out of bounds horizontally. fixed text boxes to not grab selectonOnLoad focus unless they're in an active tab.
Diffstat (limited to 'src/client/views/nodes/formattedText/FormattedTextBox.tsx')
-rw-r--r-- | src/client/views/nodes/formattedText/FormattedTextBox.tsx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx index a998386d8..b0199b35f 100644 --- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx +++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx @@ -1123,6 +1123,14 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp } } + private isActiveTab(el: Element | null | undefined) { + do { + if (el?.className.includes("lm_active")) return true; + el = el?.parentNode as any; + } while (el !== document.body); + return false; + } + private setupEditor(config: any, fieldKey: string) { const curText = Cast(this.dataDoc[this.props.fieldKey], RichTextField, null); const rtfField = Cast((!curText?.Text && this.layoutDoc[this.props.fieldKey]) || this.dataDoc[fieldKey], RichTextField); @@ -1161,7 +1169,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp } const selectOnLoad = this.rootDoc[Id] === FormattedTextBox.SelectOnLoad; - if (selectOnLoad && !this.props.dontRegisterView && !this.props.dontSelectOnLoad) { + if (selectOnLoad && !this.props.dontRegisterView && !this.props.dontSelectOnLoad && this.isActiveTab(this.ProseRef)) { FormattedTextBox.SelectOnLoad = ""; this.props.select(false); if (FormattedTextBox.SelectOnLoadChar && this._editorView) { |