aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/button/FontIconBox.tsx
diff options
context:
space:
mode:
authormehekj <mehek.jethani@gmail.com>2022-02-03 18:03:52 -0500
committermehekj <mehek.jethani@gmail.com>2022-02-03 18:03:52 -0500
commit922747ad959e95b592b4cde951b31f5503b8970b (patch)
treee25d747ba02b4cbfd76910b862b6aac104614daf /src/client/views/nodes/button/FontIconBox.tsx
parent30369cd78c1815a81bfe153c5a2d4551ad90dbe0 (diff)
parent4cdfa6c29701d372064eb4dc612807a27cb19857 (diff)
Merge branch 'master' into temporalmedia-mehek
Diffstat (limited to 'src/client/views/nodes/button/FontIconBox.tsx')
-rw-r--r--src/client/views/nodes/button/FontIconBox.tsx28
1 files changed, 4 insertions, 24 deletions
diff --git a/src/client/views/nodes/button/FontIconBox.tsx b/src/client/views/nodes/button/FontIconBox.tsx
index 33fa23805..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) {
@@ -766,7 +746,7 @@ Scripting.addGlobal(function setActiveInkTool(tool: string, checkResult?: boolea
Doc.UserDoc().activeInkTool = InkTool.Pen;
GestureOverlay.Instance.InkShape = tool;
}
- } else if (tool) { // pen
+ } else if (tool) { // pen or eraser
if (Doc.UserDoc().activeInkTool === tool && !GestureOverlay.Instance.InkShape) {
Doc.UserDoc().activeInkTool = InkTool.None;
} else {