diff options
author | bobzel <zzzman@gmail.com> | 2021-09-22 04:46:24 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2021-09-22 04:46:24 -0400 |
commit | cbd8f931480ecfdc9c22cd2daa633e9b80b5a6e2 (patch) | |
tree | 2fe05450a07dcb7fea2097aaf58edc2ddc2547c0 /src | |
parent | 12ae56962397a786397158af9e442a955883d16f (diff) |
fromlast
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/nodes/formattedText/RichTextMenu.tsx | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/client/views/nodes/formattedText/RichTextMenu.tsx b/src/client/views/nodes/formattedText/RichTextMenu.tsx index 23a3d80a4..0a2a54aae 100644 --- a/src/client/views/nodes/formattedText/RichTextMenu.tsx +++ b/src/client/views/nodes/formattedText/RichTextMenu.tsx @@ -334,13 +334,11 @@ export class RichTextMenu extends AntimodeMenu<AntimodeMenuProps> { } setColor(color: String, view: EditorView, dispatch: any) { - const colorMark = view.state.schema.mark(view.state.schema.marks.pFontColor, { color }); - if (view.state.selection.empty) { - dispatch(view.state.tr.addStoredMark(colorMark)); - return false; + if (this.view) { + const colorMark = view.state.schema.mark(view.state.schema.marks.pFontColor, { color }); + view.focus(); + this.setMark(colorMark, this.view.state, (tx: any) => this.view!.dispatch(tx.addStoredMark(colorMark)), true); } - this.setMark(colorMark, view.state, dispatch, true); - view.focus(); } // TODO: remove doesn't work |