]> BookStack Code Mirror - bookstack/blobdiff - resources/js/wysiwyg/utils/diagrams.ts
Lexical: Started adding editor shortcuts
[bookstack] / resources / js / wysiwyg / utils / diagrams.ts
index 2dee3ab6b0d3cc12219dfe9097648a21b10d9ed4..fb5543005c2b8f5e26ccc39e187ecb9d36ff9012 100644 (file)
@@ -5,7 +5,7 @@ import * as DrawIO from "../../services/drawio";
 import {$createDiagramNode, DiagramNode} from "../nodes/diagram";
 import {ImageManager} from "../../components";
 import {EditorImageData} from "./images";
-import {$getNodeFromSelection} from "./selection";
+import {$getNodeFromSelection, getLastSelection} from "./selection";
 
 export function $isDiagramNode(node: LexicalNode | null | undefined): node is DiagramNode {
     return node instanceof DiagramNode;
@@ -80,7 +80,7 @@ export function showDiagramManager(callback: (image: EditorImageData) => any) {
 }
 
 export function showDiagramManagerForInsert(context: EditorUiContext) {
-    const selection = context.lastSelection;
+    const selection = getLastSelection(context.editor);
     showDiagramManager((image: EditorImageData) => {
         context.editor.update(() => {
             const diagramNode = $createDiagramNode(image.id, image.url);