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 | 1x 1x 1x 10x 10x 6x 10x 17x 17x 17x 17x 17x | import { canMergeCells } from './canMergeCells'; import { getSelectedCells, mutateBlock } from 'roosterjs-content-model-dom'; import type { ShallowMutableContentModelTable } from 'roosterjs-content-model-types'; /** * @internal */ export function mergeTableCells(table: ShallowMutableContentModelTable) { const sel = getSelectedCells(table); if ( sel && canMergeCells(table.rows, sel.firstRow, sel.firstColumn, sel.lastRow, sel.lastColumn) ) { for (let rowIndex = sel.firstRow; rowIndex <= sel.lastRow; rowIndex++) { for (let colIndex = sel.firstColumn; colIndex <= sel.lastColumn; colIndex++) { const cell = table.rows[rowIndex].cells[colIndex]; Eif (cell) { const mutableCell = mutateBlock(cell); mutableCell.spanLeft = colIndex > sel.firstColumn; mutableCell.spanAbove = rowIndex > sel.firstRow; } } } } } |