diff options
author | bobzel <zzzman@gmail.com> | 2021-12-03 14:39:40 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2021-12-03 14:39:40 -0500 |
commit | 4bad9d544879f5d59becb2c0e22c9ff5800f2890 (patch) | |
tree | 83f88d1163f6ad89161df9fb8bf6bbba9914dc96 /src/client/views/nodes/formattedText/FormattedTextBox.tsx | |
parent | f92b490d3d54f5847f5f434a4105e88717531527 (diff) |
cleaned up text alignment buttons & initialization in formatted text box
Diffstat (limited to 'src/client/views/nodes/formattedText/FormattedTextBox.tsx')
-rw-r--r-- | src/client/views/nodes/formattedText/FormattedTextBox.tsx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx index e61f96852..4a6af86c1 100644 --- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx +++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx @@ -1146,9 +1146,11 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp const startupText = Field.toString(this.dataDoc[fieldKey] as Field); if (startupText) { dispatch(state.tr.insertText(startupText)); - } else if (!FormattedTextBox.LiveTextUndo) { + } + const textAlign = StrCast(this.dataDoc["text-align"], StrCast(Doc.UserDoc().textAlign, "left")); + if (textAlign !== "left") { selectAll(this._editorView.state, (tr) => { - this._editorView!.dispatch(tr.replaceSelectionWith(state.schema.nodes.paragraph.create({ align: "center" }))); + this._editorView!.dispatch(tr.replaceSelectionWith(state.schema.nodes.paragraph.create({ align: textAlign }))); }); } } |