aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/FormattedTextBox.tsx
diff options
context:
space:
mode:
authorab <abdullah_ahmed@brown.edu>2019-07-08 15:25:06 -0400
committerab <abdullah_ahmed@brown.edu>2019-07-08 15:25:06 -0400
commitf65f3f16b50a3e43555626ed5fb97c78aed9c5a4 (patch)
treeab800ee62d00b6e6382e9b530447e67cf5d06f15 /src/client/views/nodes/FormattedTextBox.tsx
parent7627ed4d04f9bdcc2144c2b82197881e3f097c9a (diff)
idk
Diffstat (limited to 'src/client/views/nodes/FormattedTextBox.tsx')
-rw-r--r--src/client/views/nodes/FormattedTextBox.tsx28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx
index 3c40819a8..a5fa4582d 100644
--- a/src/client/views/nodes/FormattedTextBox.tsx
+++ b/src/client/views/nodes/FormattedTextBox.tsx
@@ -256,17 +256,6 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe
}, { fireImmediately: true });
}
- this._searchReactionDisposer = reaction(() => {
- return StrCast(this.props.Document.search_string);
- }, searchString => {
- if (searchString) {
- this.highlightSearchTerms([searchString]);
- }
- else {
- this.unhighlightSearchTerms();
- }
- });
-
this._reactionDisposer = reaction(
() => {
const field = this.dataDoc ? Cast(this.dataDoc[this.props.fieldKey], RichTextField) : undefined;
@@ -275,7 +264,24 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe
field => this._editorView && !this._applyingChange && this.props.Document[this.props.fieldKey] instanceof RichTextField &&
this._editorView.updateState(EditorState.fromJSON(config, JSON.parse(field)))
);
+
this.setupEditor(config, this.dataDoc, this.props.fieldKey);
+
+ this._searchReactionDisposer = reaction(() => {
+ return StrCast(this.props.Document.search_string);
+ }, searchString => {
+ const fieldkey = 'preview';
+ let preview = false;
+ // if (!this._editorView && Object.keys(this.props.Document).indexOf(fieldkey) !== -1) {
+ // preview = true;
+ // }
+ if (searchString) {
+ this.highlightSearchTerms([searchString]);
+ }
+ else {
+ this.unhighlightSearchTerms();
+ }
+ }, { fireImmediately: true });
}
private setupEditor(config: any, doc: Doc, fieldKey: string) {