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 | 1x 1x 1x 857x 857x 857x 1208x | import { createListLevel } from './createListLevel';
import { createSelectionMarker } from './createSelectionMarker';
import type {
ContentModelListItem,
ContentModelSegmentFormat,
ReadonlyContentModelListLevel,
} from 'roosterjs-content-model-types';
/**
* Create a ContentModelListItem model
* @param levels Existing list levels
* @param format @optional The format of this model
*/
export function createListItem(
levels: ReadonlyArray<ReadonlyContentModelListLevel>,
format?: Readonly<ContentModelSegmentFormat>
): ContentModelListItem {
const formatHolder = createSelectionMarker(format);
formatHolder.isSelected = false;
return {
blockType: 'BlockGroup',
blockGroupType: 'ListItem',
blocks: [],
levels: levels
? levels.map(level => createListLevel(level.listType, level.format, level.dataset))
: [],
formatHolder,
format: {},
};
}
|