]> BookStack Code Mirror - bookstack/blobdiff - resources/js/wysiwyg/ui/framework/helpers/table-selection-handler.ts
Comments: Switched to lexical editor
[bookstack] / resources / js / wysiwyg / ui / framework / helpers / table-selection-handler.ts
index f631fb804a550d82a67fe49c23b5722c9834e001..c05e448f5a08f8ba890cce8344d17ead23be7e87 100644 (file)
@@ -1,12 +1,12 @@
 import {$getNodeByKey, LexicalEditor} from "lexical";
 import {NodeKey} from "lexical/LexicalNode";
 import {
+    $isTableNode,
     applyTableHandlers,
     HTMLTableElementWithWithTableSelectionState,
     TableNode,
     TableObserver
 } from "@lexical/table";
-import {$isCustomTableNode, CustomTableNode} from "../../../nodes/custom-table";
 
 // File adapted from logic in:
 // https://github.com/facebook/lexical/blob/f373759a7849f473d34960a6bf4e34b2a011e762/packages/lexical-react/src/LexicalTablePlugin.ts#L49
@@ -25,12 +25,12 @@ class TableSelectionHandler {
     }
 
     protected init() {
-        this.unregisterMutationListener = this.editor.registerMutationListener(CustomTableNode, (mutations) => {
+        this.unregisterMutationListener = this.editor.registerMutationListener(TableNode, (mutations) => {
             for (const [nodeKey, mutation] of mutations) {
                 if (mutation === 'created') {
                     this.editor.getEditorState().read(() => {
-                        const tableNode = $getNodeByKey<CustomTableNode>(nodeKey);
-                        if ($isCustomTableNode(tableNode)) {
+                        const tableNode = $getNodeByKey<TableNode>(nodeKey);
+                        if ($isTableNode(tableNode)) {
                             this.initializeTableNode(tableNode);
                         }
                     });
@@ -56,7 +56,7 @@ class TableSelectionHandler {
                 tableNode,
                 tableElement,
                 this.editor,
-                false,
+                true,
             );
             this.tableSelections.set(nodeKey, tableSelection);
         }