aboutsummaryrefslogtreecommitdiff
path: root/src/views/nodes/FormattedTextBox.tsx
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-02-06 16:11:42 -0500
committerbob <bcz@cs.brown.edu>2019-02-06 16:11:42 -0500
commit59d5992f2a101eff7743328c3fdefe6a0006ada9 (patch)
treeb28dbb2e06f1fffeafcd2b43845072f9f3f6f1fc /src/views/nodes/FormattedTextBox.tsx
parent7598b88bbad9690c59f8b164144aa0d02a0a211f (diff)
parent84eea14a86265ce0585342d9f3a3c4107c02df17 (diff)
woring db stub.
Diffstat (limited to 'src/views/nodes/FormattedTextBox.tsx')
-rw-r--r--src/views/nodes/FormattedTextBox.tsx22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/views/nodes/FormattedTextBox.tsx b/src/views/nodes/FormattedTextBox.tsx
index cf6a1181a..3e3e22e46 100644
--- a/src/views/nodes/FormattedTextBox.tsx
+++ b/src/views/nodes/FormattedTextBox.tsx
@@ -6,7 +6,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, WAITING } from "../../fields/Field";
+import { Opt, FieldWaiting } from "../../fields/Field";
import { SelectionManager } from "../../util/SelectionManager";
import "./FormattedTextBox.scss";
import React = require("react")
@@ -48,11 +48,11 @@ export class FormattedTextBox extends React.Component<FieldViewProps> {
}
dispatchTransaction = (tx: Transaction) => {
- if (this._editorView && this._editorView != WAITING) {
+ if (this._editorView && this._editorView != FieldWaiting) {
const state = this._editorView.state.apply(tx);
this._editorView.updateState(state);
const { doc, fieldKey } = this.props;
- doc.SetFieldValue(fieldKey, JSON.stringify(state.toJSON()), RichTextField);
+ doc.SetData(fieldKey, JSON.stringify(state.toJSON()), RichTextField);
}
}
@@ -68,8 +68,8 @@ export class FormattedTextBox extends React.Component<FieldViewProps> {
]
};
- let field = doc.GetFieldT(fieldKey, RichTextField);
- if (field && field != WAITING) { // bcz: don't think this works
+ let field = doc.GetT(fieldKey, RichTextField);
+ if (field && field != FieldWaiting) { // bcz: don't think this works
state = EditorState.fromJSON(config, JSON.parse(field.Data));
} else {
state = EditorState.create(config);
@@ -82,20 +82,20 @@ export class FormattedTextBox extends React.Component<FieldViewProps> {
}
this._reactionDisposer = reaction(() => {
- const field = this.props.doc.GetFieldT(this.props.fieldKey, RichTextField);
- return field && field != WAITING ? field.Data : undefined;
+ const field = this.props.doc.GetT(this.props.fieldKey, RichTextField);
+ return field && field != FieldWaiting ? field.Data : undefined;
}, (field) => {
- if (field && this._editorView && this._editorView != WAITING) {
+ if (field && this._editorView && this._editorView != FieldWaiting) {
this._editorView.updateState(EditorState.fromJSON(config, JSON.parse(field)));
}
})
}
componentWillUnmount() {
- if (this._editorView && this._editorView != WAITING) {
+ if (this._editorView && this._editorView != FieldWaiting) {
this._editorView.destroy();
}
- if (this._reactionDisposer && this._reactionDisposer != WAITING) {
+ if (this._reactionDisposer && this._reactionDisposer != FieldWaiting) {
this._reactionDisposer();
}
}
@@ -107,7 +107,7 @@ export class FormattedTextBox extends React.Component<FieldViewProps> {
@action
onChange(e: React.ChangeEvent<HTMLInputElement>) {
const { fieldKey, doc } = this.props;
- doc.SetFieldValue(fieldKey, e.target.value, RichTextField);
+ doc.SetData(fieldKey, e.target.value, RichTextField);
}
onPointerDown = (e: React.PointerEvent): void => {
let me = this;