]> BookStack Code Mirror - bookstack/blobdiff - resources/js/wysiwyg/ui/framework/toolbars.ts
Lexical: Added a media toolbar, improved toolbars and media selection
[bookstack] / resources / js / wysiwyg / ui / framework / toolbars.ts
index d7c48193479266ae51d3739b8bca005afb407d34..de2255444ebf6fcfc43fb7a9a225c3f36c208cc1 100644 (file)
@@ -1,5 +1,6 @@
 import {EditorContainerUiElement, EditorUiElement} from "./core";
-import {el} from "../../helpers";
+
+import {el} from "../../utils/dom";
 
 export type EditorContextToolbarDefinition = {
     selector: string;
@@ -33,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;
         }