]> BookStack Code Mirror - bookstack/blobdiff - resources/js/wysiwyg/ui/defaults/buttons/controls.ts
Lexical: Added about button/view
[bookstack] / resources / js / wysiwyg / ui / defaults / buttons / controls.ts
index ad69d69d13c43fb90d07ca941003a7fd868e0a2f..5e32005393e8d813f278b21d42a7ebcb118bdfee 100644 (file)
@@ -11,14 +11,16 @@ import {
 } from "lexical";
 import redoIcon from "@icons/editor/redo.svg";
 import sourceIcon from "@icons/editor/source-view.svg";
-import {getEditorContentAsHtml} from "../../../actions";
 import fullscreenIcon from "@icons/editor/fullscreen.svg";
+import aboutIcon from "@icons/editor/about.svg";
+import {getEditorContentAsHtml} from "../../../utils/actions";
 
 export const undo: EditorButtonDefinition = {
     label: 'Undo',
     icon: undoIcon,
     action(context: EditorUiContext) {
         context.editor.dispatchCommand(UNDO_COMMAND, undefined);
+        context.manager.triggerFutureStateRefresh();
     },
     isActive(selection: BaseSelection|null): boolean {
         return false;
@@ -38,6 +40,7 @@ export const redo: EditorButtonDefinition = {
     icon: redoIcon,
     action(context: EditorUiContext) {
         context.editor.dispatchCommand(REDO_COMMAND, undefined);
+        context.manager.triggerFutureStateRefresh();
     },
     isActive(selection: BaseSelection|null): boolean {
         return false;
@@ -54,7 +57,7 @@ export const redo: EditorButtonDefinition = {
 
 
 export const source: EditorButtonDefinition = {
-    label: 'Source code',
+    label: 'Source',
     icon: sourceIcon,
     async action(context: EditorUiContext) {
         const modal = context.manager.createModal('source');
@@ -78,4 +81,16 @@ export const fullscreen: EditorButtonDefinition = {
     isActive(selection, context: EditorUiContext) {
         return context.containerDOM.classList.contains('fullscreen');
     }
+};
+
+export const about: EditorButtonDefinition = {
+    label: 'About the editor',
+    icon: aboutIcon,
+    async action(context: EditorUiContext, button: EditorButton) {
+        const modal = context.manager.createModal('about');
+        modal.show({});
+    },
+    isActive(selection, context: EditorUiContext) {
+        return false;
+    }
 };
\ No newline at end of file