diff options
| author | tschicke-brown <tyler_schicke@brown.edu> | 2019-04-08 21:59:41 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-04-08 21:59:41 -0400 |
| commit | fbb5f2c19ffd1278d31b432a74ec3ae747b85894 (patch) | |
| tree | b6a4255bd3a0a3c30504639f3e0e7a48ebadd420 /src/client/views/nodes/FormattedTextBox.tsx | |
| parent | a2135bcc0a995378aad0e71ade832a4d526a37f0 (diff) | |
| parent | e963f324fe8436ff5fc8ee21cdf091b6265690f9 (diff) | |
Merge pull request #81 from browngraphicslab/propsRefactor
Props refactor
Diffstat (limited to 'src/client/views/nodes/FormattedTextBox.tsx')
| -rw-r--r-- | src/client/views/nodes/FormattedTextBox.tsx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx index 6a38fbe0e..7a94be12b 100644 --- a/src/client/views/nodes/FormattedTextBox.tsx +++ b/src/client/views/nodes/FormattedTextBox.tsx @@ -63,7 +63,7 @@ export class FormattedTextBox extends React.Component<FieldViewProps> { } }; - get FieldDoc() { return this.props.fieldKey === KeyStore.Archives ? Main.Instance._textDoc! : this.props.doc; } + get FieldDoc() { return this.props.fieldKey === KeyStore.Archives ? Main.Instance._textDoc! : this.props.Document; } get FieldKey() { return this.props.fieldKey === KeyStore.Archives ? KeyStore.Data : this.props.fieldKey; } componentDidMount() { @@ -92,7 +92,7 @@ export class FormattedTextBox extends React.Component<FieldViewProps> { this._reactionDisposer = reaction( () => { const field = this.FieldDoc.GetT(this.FieldKey, RichTextField); - return field && field != FieldWaiting ? field.Data : undefined; + return field && field !== FieldWaiting ? field.Data : undefined; }, field => { if (field && this._editorView) { @@ -109,7 +109,7 @@ export class FormattedTextBox extends React.Component<FieldViewProps> { let state: EditorState; let field = this.FieldDoc.GetT(this.FieldKey, RichTextField); - if (field && field != FieldWaiting && field.Data) { + if (field && field !== FieldWaiting && field.Data) { state = EditorState.fromJSON(config, JSON.parse(field.Data)); } else { state = EditorState.create(config); @@ -122,7 +122,7 @@ export class FormattedTextBox extends React.Component<FieldViewProps> { } if (this.props.selectOnLoad) { - this.props.select(); + this.props.select(false); this._editorView!.focus(); } } @@ -145,8 +145,8 @@ export class FormattedTextBox extends React.Component<FieldViewProps> { @action onChange(e: React.ChangeEvent<HTMLInputElement>) { - const { fieldKey, doc } = this.props; - doc.SetOnPrototype(fieldKey, new RichTextField(e.target.value)); + const { fieldKey, Document } = this.props; + Document.SetOnPrototype(fieldKey, new RichTextField(e.target.value)); // doc.SetData(fieldKey, e.target.value, RichTextField); } onPointerDown = (e: React.PointerEvent): void => { @@ -160,13 +160,13 @@ export class FormattedTextBox extends React.Component<FieldViewProps> { } if (this.props.fieldKey !== KeyStore.Archives) { e.preventDefault(); - Main.Instance.SetTextDoc(this.props.doc, this._ref.current!); + Main.Instance.SetTextDoc(this.props.Document, this._ref.current!); } }; onFocused = (e: React.FocusEvent): void => { if (this.props.fieldKey !== KeyStore.Archives) { - Main.Instance.SetTextDoc(this.props.doc, this._ref.current!); + Main.Instance.SetTextDoc(this.props.Document, this._ref.current!); } } |
