From 26af9562cc515627be4be8759b70ebfbab8bb83c Mon Sep 17 00:00:00 2001 From: bob Date: Tue, 5 Feb 2019 17:41:12 -0500 Subject: first changes --- src/views/nodes/FormattedTextBox.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/views/nodes/FormattedTextBox.tsx') diff --git a/src/views/nodes/FormattedTextBox.tsx b/src/views/nodes/FormattedTextBox.tsx index 9c4b24226..f0385c096 100644 --- a/src/views/nodes/FormattedTextBox.tsx +++ b/src/views/nodes/FormattedTextBox.tsx @@ -5,7 +5,7 @@ import { keymap } from "prosemirror-keymap"; import { schema } from "prosemirror-schema-basic"; import { EditorState, Transaction } from "prosemirror-state"; import { EditorView } from "prosemirror-view"; -import { Opt } from "../../fields/Field"; +import { Opt, WAITING } from "../../fields/Field"; import { SelectionManager } from "../../util/SelectionManager"; import "./FormattedTextBox.scss"; import React = require("react") @@ -46,7 +46,7 @@ export class FormattedTextBox extends React.Component { } dispatchTransaction = (tx: Transaction) => { - if (this._editorView) { + if (this._editorView && this._editorView != WAITING) { const state = this._editorView.state.apply(tx); this._editorView.updateState(state); const { doc, fieldKey } = this.props; @@ -67,7 +67,7 @@ export class FormattedTextBox extends React.Component { }; let field = doc.GetFieldT(fieldKey, RichTextField); - if (field) { + if (field && field != WAITING) { // bcz: don't think this works state = EditorState.fromJSON(config, JSON.parse(field.Data)); } else { state = EditorState.create(config); @@ -81,19 +81,19 @@ export class FormattedTextBox extends React.Component { this._reactionDisposer = reaction(() => { const field = this.props.doc.GetFieldT(this.props.fieldKey, RichTextField); - return field ? field.Data : undefined; + return field && field != WAITING ? field.Data : undefined; }, (field) => { - if (field && this._editorView) { + if (field && this._editorView && this._editorView != WAITING) { this._editorView.updateState(EditorState.fromJSON(config, JSON.parse(field))); } }) } componentWillUnmount() { - if (this._editorView) { + if (this._editorView && this._editorView != WAITING) { this._editorView.destroy(); } - if (this._reactionDisposer) { + if (this._reactionDisposer && this._reactionDisposer != WAITING) { this._reactionDisposer(); } } -- cgit v1.2.3-70-g09d2