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 47 48 49 50 51 52 53 | 1x 18x 16x 2x 16x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 2x | import type { BeforeLogicalRootChangeEvent, LogicalRootChangedEvent, SetLogicalRoot, } from 'roosterjs-content-model-types'; /** * @internal * Change which node is the current logical root * @param core The StandaloneEditorCore object * @param logicalRoot The new logical root (has to be child of physicalRoot), pass null to use physicalRoot as logical root */ export const setLogicalRoot: SetLogicalRoot = (core, logicalRoot) => { // make sure we either want to reset to physical root or the logical root is a child of physical root if (!logicalRoot || core.physicalRoot.contains(logicalRoot)) { // if null, reset to physical root if (!logicalRoot) { logicalRoot = core.physicalRoot; } // if the logical root changed if (logicalRoot !== core.logicalRoot) { // tell plugins that the logical root is about to change, so they can clean up listeners or caches const beforeLogicalRootEvent: BeforeLogicalRootChangeEvent = { eventType: 'beforeLogicalRootChange', logicalRoot: core.logicalRoot, }; core.api.triggerEvent(core, beforeLogicalRootEvent, false /*broadcast*/); // make sure the old logical root is not content editable and the new one is core.logicalRoot.contentEditable = 'false'; logicalRoot.contentEditable = 'true'; // update the logical root core.logicalRoot = logicalRoot; // clear internal caches core.selection.selection = null; core.cache.cachedModel = undefined; core.cache.cachedSelection = undefined; // tell plugins in case they need to clear their caches const event: LogicalRootChangedEvent = { eventType: 'logicalRootChanged', logicalRoot, }; core.api.triggerEvent(core, event, false /*broadcast*/); } } else { return null; } }; |