]> BookStack Code Mirror - bookstack/blobdiff - resources/js/wysiwyg/lexical/table/LexicalTableSelectionHelpers.ts
Lexical: Merged custom table node code
[bookstack] / resources / js / wysiwyg / lexical / table / LexicalTableSelectionHelpers.ts
index 812cccc0d251550134ff1b2256a22bad8c2be6a6..6c3317c5dfaff54878b9c3bd72e751fb4fd0f695 100644 (file)
@@ -438,59 +438,6 @@ export function applyTableHandlers(
     ),
   );
 
-  tableObserver.listenersToRemove.add(
-    editor.registerCommand<ElementFormatType>(
-      FORMAT_ELEMENT_COMMAND,
-      (formatType) => {
-        const selection = $getSelection();
-        if (
-          !$isTableSelection(selection) ||
-          !$isSelectionInTable(selection, tableNode)
-        ) {
-          return false;
-        }
-
-        const anchorNode = selection.anchor.getNode();
-        const focusNode = selection.focus.getNode();
-        if (!$isTableCellNode(anchorNode) || !$isTableCellNode(focusNode)) {
-          return false;
-        }
-
-        const [tableMap, anchorCell, focusCell] = $computeTableMap(
-          tableNode,
-          anchorNode,
-          focusNode,
-        );
-        const maxRow = Math.max(anchorCell.startRow, focusCell.startRow);
-        const maxColumn = Math.max(
-          anchorCell.startColumn,
-          focusCell.startColumn,
-        );
-        const minRow = Math.min(anchorCell.startRow, focusCell.startRow);
-        const minColumn = Math.min(
-          anchorCell.startColumn,
-          focusCell.startColumn,
-        );
-        for (let i = minRow; i <= maxRow; i++) {
-          for (let j = minColumn; j <= maxColumn; j++) {
-            const cell = tableMap[i][j].cell;
-            cell.setFormat(formatType);
-
-            const cellChildren = cell.getChildren();
-            for (let k = 0; k < cellChildren.length; k++) {
-              const child = cellChildren[k];
-              if ($isElementNode(child) && !child.isInline()) {
-                child.setFormat(formatType);
-              }
-            }
-          }
-        }
-        return true;
-      },
-      COMMAND_PRIORITY_CRITICAL,
-    ),
-  );
-
   tableObserver.listenersToRemove.add(
     editor.registerCommand(
       CONTROLLED_TEXT_INSERTION_COMMAND,