aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/FormattedTextBox.tsx
diff options
context:
space:
mode:
authorab <abdullah_ahmed@brown.edu>2019-07-05 13:45:21 -0400
committerab <abdullah_ahmed@brown.edu>2019-07-05 13:45:21 -0400
commit27a2711343135f8d5b784bf446941a377a533488 (patch)
treedbb661df0c5c6af0323b64ad90ba3297b56c2946 /src/client/views/nodes/FormattedTextBox.tsx
parenta223d6a4283c976ad3c5a2fd97df5a6bb0542722 (diff)
unhigh
Diffstat (limited to 'src/client/views/nodes/FormattedTextBox.tsx')
-rw-r--r--src/client/views/nodes/FormattedTextBox.tsx17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx
index 340455677..2fdb16cc3 100644
--- a/src/client/views/nodes/FormattedTextBox.tsx
+++ b/src/client/views/nodes/FormattedTextBox.tsx
@@ -152,9 +152,7 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe
if (terms.includes(word) && this._editorView) {
this._editorView.dispatch(this._editorView.state.tr.addMark(start, start + word.length, mark).removeStoredMark(mark));
}
- else {
- start += word.length + 1;
- }
+ start += word.length + 1;
});
}
});
@@ -172,6 +170,12 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe
}
}
});
+ // const fieldkey = 'search_string';
+ // if (Object.keys(this.props.Document).indexOf(fieldkey) !== -1) {
+ // this.props.Document[fieldkey] = undefined;
+ // }
+ // else this.props.Document.proto![fieldkey] = undefined;
+ // }
}
}
@@ -255,7 +259,12 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe
this._searchReactionDisposer = reaction(() => {
return StrCast(this.props.Document.search_string);
}, searchString => {
- this.highlightSearchTerms([searchString]);
+ if (searchString) {
+ this.highlightSearchTerms([searchString]);
+ }
+ else {
+ this.unhighlightSearchTerms();
+ }
});
this._reactionDisposer = reaction(