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 43 44 | 1x 3922x 3922x 193x 3922x 1714x 3922x 154x 3922x | import type { ContentModelBlockFormat, ContentModelParagraph, ContentModelSegmentFormat, ReadonlyContentModelParagraphDecorator, } from 'roosterjs-content-model-types'; /** * Create a ContentModelParagraph model * @param isImplicit @optional Whether this is an implicit paragraph. An implicit paragraph is a paragraph that will not render with DOM element container * @param blockFormat @optional Format of this paragraph * @param segmentFormat @optional Segment format applied to this block * @param decorator @optional Decorator of this paragraph */ export function createParagraph( isImplicit?: boolean, blockFormat?: Readonly<ContentModelBlockFormat>, segmentFormat?: Readonly<ContentModelSegmentFormat>, decorator?: ReadonlyContentModelParagraphDecorator ): ContentModelParagraph { const result: ContentModelParagraph = { blockType: 'Paragraph', segments: [], format: { ...blockFormat }, }; if (segmentFormat && Object.keys(segmentFormat).length > 0) { result.segmentFormat = { ...segmentFormat }; } if (isImplicit) { result.isImplicit = true; } if (decorator) { result.decorator = { tagName: decorator.tagName, format: { ...decorator.format }, }; } return result; } |