]> BookStack Code Mirror - bookstack/blobdiff - resources/js/wysiwyg/ui/framework/toolbars.ts
Lexical: Started comment implementation
[bookstack] / resources / js / wysiwyg / ui / framework / toolbars.ts
index b4e49af950c93342a216b90931b1f7af4aaaa861..323b17450085ce4a3ddc30e13d32b3ee2311db01 100644 (file)
@@ -4,7 +4,7 @@ import {el} from "../../utils/dom";
 
 export type EditorContextToolbarDefinition = {
     selector: string;
-    content: EditorUiElement[],
+    content: () => EditorUiElement[],
     displayTargetLocator?: (originalTarget: HTMLElement) => HTMLElement;
 };
 
@@ -34,7 +34,11 @@ export class EditorContextToolbar extends EditorContainerUiElement {
 
         dom.hidden = !showing;
 
-        if (!showing) {
+        if (!this.target.isConnected) {
+            // If our target is no longer in the DOM, tell the manager an update is needed.
+            this.getContext().manager.triggerFutureStateRefresh();
+            return;
+        } else if (!showing) {
             return;
         }