diff options
author | bobzel <zzzman@gmail.com> | 2020-08-12 08:26:41 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2020-08-12 08:26:41 -0400 |
commit | 08d367f51eb73cf947f07f74c1889605170424f8 (patch) | |
tree | d77f7b958c8a15f884b2edf122a6ea1851b07108 /src/client/views/nodes/formattedText/FormattedTextBox.tsx | |
parent | 1e0a4e1df6127a94c5a0c3cb717699b722603985 (diff) | |
parent | 8fd9d9348de59caccfac9e98102fea431ac46999 (diff) |
Merge branch 'master' into schema_search
Diffstat (limited to 'src/client/views/nodes/formattedText/FormattedTextBox.tsx')
-rw-r--r-- | src/client/views/nodes/formattedText/FormattedTextBox.tsx | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx index 31d69327b..f1eb5ef09 100644 --- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx +++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx @@ -404,10 +404,9 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp } } - const lastSel = Math.min(flattened.length - 1, this._searchIndex); flattened.forEach((h: TextSelection, ind: number) => tr = tr.addMark(h.from, h.to, ind === lastSel ? activeMark : mark)); - this._editorView.dispatch(tr.setSelection(new TextSelection(tr.doc.resolve(flattened[lastSel].from), tr.doc.resolve(flattened[lastSel].to))).scrollIntoView()); + flattened[lastSel] && this._editorView.dispatch(tr.setSelection(new TextSelection(tr.doc.resolve(flattened[lastSel].from), tr.doc.resolve(flattened[lastSel].to))).scrollIntoView()); console.log(this._searchIndex); } |