diff options
author | geireann <geireann.lindfield@gmail.com> | 2021-08-26 12:40:42 -0400 |
---|---|---|
committer | geireann <geireann.lindfield@gmail.com> | 2021-08-26 12:40:42 -0400 |
commit | 702ba59ac0235e24121ffff9fcca7c35717867ab (patch) | |
tree | 6abf9ee11b0a1cbf8e996ca359fb8a5a361d4ef9 /src/client/views/nodes/button/FontIconBox.tsx | |
parent | cf7beac8b1de637fb4c0de86234ab617798d9379 (diff) |
hopefully ready!
Diffstat (limited to 'src/client/views/nodes/button/FontIconBox.tsx')
-rw-r--r-- | src/client/views/nodes/button/FontIconBox.tsx | 53 |
1 files changed, 49 insertions, 4 deletions
diff --git a/src/client/views/nodes/button/FontIconBox.tsx b/src/client/views/nodes/button/FontIconBox.tsx index 5d82fe123..745a85b21 100644 --- a/src/client/views/nodes/button/FontIconBox.tsx +++ b/src/client/views/nodes/button/FontIconBox.tsx @@ -164,7 +164,7 @@ export class FontIconBox extends DocComponent<ButtonProps, FontIconDocument>(Fon e.stopPropagation(); e.preventDefault(); }} - onDoubleClick={action(() => this.rootDoc.dropDownOpen = !this.rootDoc.dropDownOpen)} + onClick={action(() => this.rootDoc.dropDownOpen = !this.rootDoc.dropDownOpen)} > <input style={{ width: 30 }} @@ -641,6 +641,25 @@ Scripting.addGlobal(function setAlignment(align: "left" | "right" | "center", ch Doc.UserDoc().textAlign = align; }); +Scripting.addGlobal(function setBulletList(mapStyle: "bullet" | "decimal", checkResult?:boolean){ + const editorView = RichTextMenu.Instance?.TextView?.EditorView; + if (checkResult){ + const active = editorView?.state && RichTextMenu.Instance.getActiveListStyle(); + console.log(active, mapStyle); + if (active === mapStyle) return Colors.MEDIUM_BLUE; + else return "transparent"; + } + if (editorView){ + const active = editorView?.state && RichTextMenu.Instance.getActiveListStyle(); + if (active === mapStyle) { + console.log("set bullet list"); + editorView?.state && RichTextMenu.Instance.changeListType(editorView.state.schema.nodes.ordered_list.create({ mapStyle: "" })); + } else { + editorView?.state && RichTextMenu.Instance.changeListType(editorView.state.schema.nodes.ordered_list.create({ mapStyle: mapStyle })); + } + } +}); + // toggle: Set overlay status of selected document Scripting.addGlobal(function setFontColor(color?: string, checkResult?: boolean) { const selected = SelectionManager.Views().length ? SelectionManager.Views()[0] : undefined; @@ -707,7 +726,7 @@ Scripting.addGlobal(function toggleBold(checkResult?: boolean) { const editorView = RichTextMenu.Instance.TextView?.EditorView; if (editorView){ console.log("editorView"); - editorView?.state && RichTextMenu.Instance.toggleBold(editorView); + editorView?.state && RichTextMenu.Instance.toggleBold(editorView, true); } SelectionManager.Views().filter(i => StrCast(i.rootDoc.type) === DocumentType.RTF).map(dv => dv.props.Document.bold = !dv.props.Document.bold); Doc.UserDoc().bold = !Doc.UserDoc().bold; @@ -720,7 +739,10 @@ Scripting.addGlobal(function toggleUnderline(checkResult?: boolean) { else return "transparent"; } const editorView = RichTextMenu.Instance.TextView?.EditorView; - + if (editorView){ + console.log("editorView"); + editorView?.state && RichTextMenu.Instance.toggleUnderline(editorView, true); + } SelectionManager.Views().filter(i => StrCast(i.rootDoc.type) === DocumentType.RTF).map(dv => dv.props.Document.underline = !dv.props.Document.underline); Doc.UserDoc().underline = !Doc.UserDoc().underline; return Doc.UserDoc().underline; @@ -732,7 +754,10 @@ Scripting.addGlobal(function toggleItalic(checkResult?: boolean) { else return "transparent"; } const editorView = RichTextMenu.Instance.TextView?.EditorView; - + if (editorView){ + console.log("editorView"); + editorView?.state && RichTextMenu.Instance.toggleItalic(editorView, true); + } SelectionManager.Views().filter(i => StrCast(i.rootDoc.type) === DocumentType.RTF).map(dv => dv.props.Document.italic = !dv.props.Document.italic); Doc.UserDoc().italic = !Doc.UserDoc().italic; return Doc.UserDoc().italic; @@ -815,4 +840,24 @@ Scripting.addGlobal(function webSetURL(url: string, checkResult?: boolean) { else if (selected && selected.type === DocumentType.WEB){ selected.data = url; } +}); + + +/** Schema + * toggleSchemaPreview + **/ + Scripting.addGlobal(function toggleSchemaPreview(checkResult?: boolean) { + const selected = SelectionManager.Views().length ? SelectionManager.Views()[0].rootDoc : undefined; + if (checkResult && selected){ + const result:boolean = NumCast(selected.schemaPreviewWidth) > 0; + if (result) return Colors.MEDIUM_BLUE; + else return "transparent"; + } + else if (selected){ + if (NumCast(selected.schemaPreviewWidth) > 0){ + selected.schemaPreviewWidth = 200; + } else { + selected.schemaPreviewWidth = 0; + } + } });
\ No newline at end of file |