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 | 1x 62x 59x 59x 59x 59x 59x 59x 59x | import { areSameRanges } from '../../corePlugin/cache/areSameSelections'; /** * @internal */ export function addRangeToSelection(doc: Document, range: Range, isReverted: boolean = false) { const selection = doc.defaultView?.getSelection(); Eif (selection) { const currentRange = selection.rangeCount > 0 && selection.getRangeAt(0); Iif (currentRange && areSameRanges(currentRange, range)) { return; } selection.removeAllRanges(); Eif (!isReverted) { selection.addRange(range); } else { selection.setBaseAndExtent( range.endContainer, range.endOffset, range.startContainer, range.startOffset ); } } } |