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 | 1x 1x 6x 6x 12x 6x 6x 6x 11x 7x 2x 1x 1x 1x 1x 1x 1x | import { unwrapBlock } from 'roosterjs-content-model-dom'; import type { DeleteSelectionStep } from 'roosterjs-content-model-types'; /** * @internal */ export const deleteParagraphStyle: DeleteSelectionStep = context => { Eif (context.deleteResult === 'nothingToDelete') { const { insertPoint } = context; const { paragraph, path } = insertPoint; const group = path[0]; const parentGroup = path[1]; // If the paragraph is empty, we will delete any style in it // This is to ensure the paragraph style is reset to default when there is no content in the paragraph if ( paragraph.segments.every( s => s.segmentType === 'SelectionMarker' || s.segmentType === 'Br' ) && paragraph.segments.filter(s => s.segmentType === 'Br').length <= 1 ) { if (Object.keys(paragraph.format).length > 0) { paragraph.format = {}; context.deleteResult = 'range'; } else Eif ( group.blocks.length == 1 && group.blocks[0] == paragraph && parentGroup && (group.blockGroupType == 'FormatContainer' || group.blockGroupType == 'ListItem' || group.blockGroupType == 'General') ) { // Still has nothing to delete, try to unwrap parent container unwrapBlock(parentGroup, group); path.shift(); context.deleteResult = 'range'; } } } }; |