diff options
author | vellichora <fangrui_tong@brown.edu> | 2020-01-07 10:49:04 -0500 |
---|---|---|
committer | vellichora <fangrui_tong@brown.edu> | 2020-01-07 10:49:04 -0500 |
commit | 3633971bd9c1f739c0d6facd74754b99a7f26db6 (patch) | |
tree | 62aab716a9a027b3b63673e3134fa651135635e5 /src/client/views/nodes/FormattedTextBox.tsx | |
parent | 9614ba541c30dc7d2b5183d5450864354d911643 (diff) | |
parent | ccd39c9a53ebf9aea84fcdcba6050145add4526f (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into textbox_fawn_fix
Diffstat (limited to 'src/client/views/nodes/FormattedTextBox.tsx')
-rw-r--r-- | src/client/views/nodes/FormattedTextBox.tsx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx index 7e81876a2..f00a24d41 100644 --- a/src/client/views/nodes/FormattedTextBox.tsx +++ b/src/client/views/nodes/FormattedTextBox.tsx @@ -218,7 +218,7 @@ export class FormattedTextBox extends DocAnnotatableComponent<(FieldViewProps & } public highlightSearchTerms = (terms: string[]) => { - if (this._editorView && (this._editorView as any).docView) { + if (this._editorView && (this._editorView as any).docView && terms.some(t => t)) { const mark = this._editorView.state.schema.mark(this._editorView.state.schema.marks.search_highlight); const activeMark = this._editorView.state.schema.mark(this._editorView.state.schema.marks.search_highlight, { selected: true }); const res = terms.filter(t => t).map(term => this.findInNode(this._editorView!, this._editorView!.state.doc, term)); @@ -1063,7 +1063,7 @@ export class FormattedTextBox extends DocAnnotatableComponent<(FieldViewProps & e.preventDefault(); return; } - let state = this._editorView!.state; + const state = this._editorView!.state; if (!state.selection.empty && e.key === "%") { state.schema.EnteringStyle = true; e.preventDefault(); |