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 45 46 | 1x 1x 1x 1x 275x 275x 275x 275x 275x 275x 275x 275x 275x 275x 275x 275x 275x 275x | import { createListLevel } from '../../modelApi/creators/createListLevel';
import { parseFormat } from '../utils/parseFormat';
import { stackFormat } from '../utils/stackFormat';
import type { ContentModelListLevel, ElementProcessor } from 'roosterjs-content-model-types';
/**
* @internal
*/
export const listProcessor: ElementProcessor<HTMLOListElement | HTMLUListElement> = (
group,
element,
context
) => {
stackFormat(
context,
{
segment: 'shallowCloneForBlock',
paragraph: 'shallowCloneForGroup',
},
() => {
const level: ContentModelListLevel = createListLevel(
element.tagName as 'OL' | 'UL',
context.blockFormat
);
const { listFormat } = context;
parseFormat(element, context.formatParsers.dataset, level.dataset, context);
parseFormat(element, context.formatParsers.listLevelThread, level.format, context);
parseFormat(element, context.formatParsers.listLevel, level.format, context);
parseFormat(element, context.formatParsers.segment, context.segmentFormat, context);
const originalListParent = listFormat.listParent;
listFormat.listParent = listFormat.listParent || group;
listFormat.levels.push(level);
try {
context.elementProcessors.child(group, element, context);
} finally {
listFormat.levels.pop();
listFormat.listParent = originalListParent;
}
}
);
};
|