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 | 1x 1x 65x 65x 15x 15x 13x 13x 13x 13x | import { createBr, createParagraph, mutateBlock } from 'roosterjs-content-model-dom';
import type { ReadonlyContentModelTableCell } from 'roosterjs-content-model-types';
/**
* @internal
*/
export function copyPreviousCellSegmentFormat(
cell: ReadonlyContentModelTableCell,
newCell: ReadonlyContentModelTableCell
) {
const block = cell.blocks[0];
if (block && block?.blockType == 'Paragraph') {
const firstSegment = block.segments[0];
if (
firstSegment &&
(firstSegment.segmentType == 'Text' ||
firstSegment.segmentType == 'Br' ||
firstSegment.segmentType == 'SelectionMarker')
) {
const newCellParagraph = createParagraph(
false /* isImplicit */,
block.format,
block.segmentFormat
);
const br = createBr(firstSegment.format);
newCellParagraph.segments.push(br);
mutateBlock(newCell).blocks.push(newCellParagraph);
}
}
}
|