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 | 1x 222x 222x 129x 258x 129x 93x | import type { CachePluginState, ContentModelDocument, DOMSelection, } from 'roosterjs-content-model-types'; /** * @internal */ export function updateCache( state: CachePluginState, model: ContentModelDocument, selection: DOMSelection | null | undefined ) { state.cachedModel = model; if (selection?.type == 'range') { const { range: { startContainer, startOffset, endContainer, endOffset }, isReverted, } = selection; state.cachedSelection = { type: 'range', isReverted: isReverted, start: { node: startContainer, offset: startOffset, }, end: { node: endContainer, offset: endOffset, }, }; } else { state.cachedSelection = selection ?? undefined; } } |