aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/FormattedTextBox.tsx
diff options
context:
space:
mode:
authormonikahedman <monika_hedman@brown.edu>2019-08-21 14:22:30 -0400
committermonikahedman <monika_hedman@brown.edu>2019-08-21 14:22:30 -0400
commit76a693012866178a3fbe037ab06cfd4482f37917 (patch)
tree898a3fa31d1b34a77fd01edd0dd5965724fac3ac /src/client/views/nodes/FormattedTextBox.tsx
parent9a39ac87972243787474d489856818f44b90d524 (diff)
djlzdkfj
Diffstat (limited to 'src/client/views/nodes/FormattedTextBox.tsx')
-rw-r--r--src/client/views/nodes/FormattedTextBox.tsx7
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);