diff options
author | monikahedman <monika_hedman@brown.edu> | 2019-08-21 14:22:30 -0400 |
---|---|---|
committer | monikahedman <monika_hedman@brown.edu> | 2019-08-21 14:22:30 -0400 |
commit | 76a693012866178a3fbe037ab06cfd4482f37917 (patch) | |
tree | 898a3fa31d1b34a77fd01edd0dd5965724fac3ac /src/client/views/nodes/FormattedTextBox.tsx | |
parent | 9a39ac87972243787474d489856818f44b90d524 (diff) |
djlzdkfj
Diffstat (limited to 'src/client/views/nodes/FormattedTextBox.tsx')
-rw-r--r-- | src/client/views/nodes/FormattedTextBox.tsx | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx index 25f611f19..d299bbf72 100644 --- a/src/client/views/nodes/FormattedTextBox.tsx +++ b/src/client/views/nodes/FormattedTextBox.tsx @@ -162,6 +162,13 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe } } + public setText = (text: string) => { + const tx = this._editorView!.state.tr.insertText(text); + const state = this._editorView!.state; + this._editorView!.dispatch(tx); + return new RichTextField(JSON.stringify(state.toJSON())); + } + dispatchTransaction = (tx: Transaction) => { if (this._editorView) { const state = this._editorView.state.apply(tx); |