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 | 1x 1x 25x 22x 35x 35x 65x 65x 33x 65x | import { mutateBlock, setSelection } from 'roosterjs-content-model-dom'; import type { ReadonlyContentModelTable, TableSelectionCoordinates, } from 'roosterjs-content-model-types'; /** * Clear selection of a table. * @param table The table model where the selection is to be cleared * @param sel The selection coordinates to be cleared */ export function clearSelectedCells( table: ReadonlyContentModelTable, sel: TableSelectionCoordinates ) { if ( sel.firstColumn >= 0 && sel.firstRow >= 0 && sel.lastColumn < table.widths.length && sel.lastRow < table.rows.length ) { for (let i = sel.firstRow; i <= sel.lastRow; i++) { const row = table.rows[i]; for (let j = sel.firstColumn; j <= sel.lastColumn; j++) { const cell = row.cells[j]; if (cell.isSelected) { mutateBlock(cell).isSelected = false; } setSelection(cell); } } } } |