Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 1x 1x 1x 15x 15x 13x 18x 18x 15x 18x 13x 13x | import { collapseTableSelection } from '../selection/collapseTableSelection'; import { getSelectedCells, mutateBlock } from 'roosterjs-content-model-dom'; import type { ShallowMutableContentModelTable } from 'roosterjs-content-model-types'; /** * @internal */ export function deleteTableColumn(table: ShallowMutableContentModelTable) { const sel = getSelectedCells(table); if (sel) { for (let rowIndex = 0; rowIndex < table.rows.length; rowIndex++) { const cellInNextCol = table.rows[rowIndex].cells[sel.lastColumn + 1]; if (cellInNextCol) { mutateBlock(cellInNextCol).spanLeft = cellInNextCol.spanLeft && table.rows[rowIndex].cells[sel.firstColumn].spanLeft; } table.rows[rowIndex].cells.splice( sel.firstColumn, sel.lastColumn - sel.firstColumn + 1 ); } table.widths.splice(sel.firstColumn, sel.lastColumn - sel.firstColumn + 1); collapseTableSelection(table.rows, sel); } } |