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 | 1x 1x 1x 32x 32x 32x 17x 17x 17x 17x 17x | import { mutateBlock } from 'roosterjs-content-model-dom'; import { splitParagraph } from '../utils/splitParagraph'; import type { DeleteSelectionStep } from 'roosterjs-content-model-types'; /** * @internal */ export const handleEnterOnParagraph: DeleteSelectionStep = context => { const { paragraph, path } = context.insertPoint; const paraIndex = path[0]?.blocks.indexOf(paragraph) ?? -1; if (context.deleteResult == 'notDeleted' && paraIndex >= 0) { const newPara = splitParagraph(context.insertPoint); mutateBlock(path[0]).blocks.splice(paraIndex + 1, 0, newPara); context.deleteResult = 'range'; context.lastParagraph = newPara; context.insertPoint.paragraph = newPara; } }; |