diff options
author | bobzel <zzzman@gmail.com> | 2021-12-10 13:36:12 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2021-12-10 13:36:12 -0500 |
commit | e54c1ef16b4ce0a324fac3747defdc6501834de5 (patch) | |
tree | e956e5bbe07e53a36e5ead3d637e6f7c2b01671b /src/client/views/nodes/button/FontIconBox.tsx | |
parent | 8176b94970b86bd3c1669130f6fef2ccd70d0b84 (diff) | |
parent | f8ce34c8ed42646691d1e392effe79bc27daf810 (diff) |
Merge branch 'master' into ink_v1
Diffstat (limited to 'src/client/views/nodes/button/FontIconBox.tsx')
-rw-r--r-- | src/client/views/nodes/button/FontIconBox.tsx | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/src/client/views/nodes/button/FontIconBox.tsx b/src/client/views/nodes/button/FontIconBox.tsx index 14b1cbb5d..bd103dcf7 100644 --- a/src/client/views/nodes/button/FontIconBox.tsx +++ b/src/client/views/nodes/button/FontIconBox.tsx @@ -636,30 +636,10 @@ Scripting.addGlobal(function getActiveTextInfo(info: "family" | "size" | "color" Scripting.addGlobal(function setAlignment(align: "left" | "right" | "center", checkResult?: boolean) { const editorView = RichTextMenu.Instance?.TextView?.EditorView; if (checkResult) { - let active: string; - if (editorView) { - active = editorView?.state && RichTextMenu.Instance.getActiveAlignment(); - } else { - active = StrCast(Doc.UserDoc().textAlign); - } - if (active === align) return Colors.MEDIUM_BLUE; - return "transparent"; + return (editorView ? RichTextMenu.Instance.textAlign : Doc.UserDoc().textAlign) === align ? Colors.MEDIUM_BLUE : "transparent"; } - SelectionManager.Docs().map(doc => doc.textAlign = align); - switch (align) { - case "left": - editorView?.state && RichTextMenu.Instance.alignLeft(editorView, editorView.dispatch); - break; - case "center": - editorView?.state && RichTextMenu.Instance.alignCenter(editorView, editorView.dispatch); - break; - case "right": - editorView?.state && RichTextMenu.Instance.alignRight(editorView, editorView.dispatch); - break; - default: - break; - } - Doc.UserDoc().textAlign = align; + if (editorView?.state) RichTextMenu.Instance.align(editorView, editorView.dispatch, align); + else Doc.UserDoc().textAlign = align; }); Scripting.addGlobal(function setBulletList(mapStyle: "bullet" | "decimal", checkResult?: boolean) { |