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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | 1x 1x 1x 10x 10x 10x 6x 6x 6x 10x 10x 10x 10x 10x 12x 12x 10x 10x 10x | import { canMergeCells } from './canMergeCells'; import { getSelectedCells, mutateBlock } from 'roosterjs-content-model-dom'; import type { ShallowMutableContentModelTable, TableHorizontalMergeOperation, } from 'roosterjs-content-model-types'; /** * @internal */ export function mergeTableColumn( table: ShallowMutableContentModelTable, operation: TableHorizontalMergeOperation ) { const sel = getSelectedCells(table); const mergeLeft = operation == 'mergeLeft'; if (sel) { const mergingColIndex = mergeLeft ? sel.firstColumn : sel.lastColumn + 1; Eif (mergingColIndex > 0 && mergingColIndex < table.rows[0].cells.length) { for (let rowIndex = sel.firstRow; rowIndex <= sel.lastRow; rowIndex++) { const cell = table.rows[rowIndex]?.cells[mergingColIndex]; Eif ( cell && canMergeCells( table.rows, rowIndex, mergingColIndex - 1, rowIndex, mergingColIndex ) ) { mutateBlock(cell).spanLeft = true; let newSelectedCol = mergingColIndex; while (table.rows[rowIndex]?.cells[newSelectedCol]?.spanLeft) { mutateBlock(table.rows[rowIndex].cells[newSelectedCol]); newSelectedCol--; } const newCell = table.rows[rowIndex]?.cells[newSelectedCol]; Eif (newCell) { mutateBlock(newCell).isSelected = true; } } } } } } |