import type TraversingScoper from './TraversingScoper'; import type { BlockElement, InlineElement } from 'roosterjs-editor-types'; /** * @internal * This is selection scoper that provide a start inline as the start of the selection * and checks if a block falls in the selection (isBlockInScope) * last trimInlineElement to trim any inline element to return a partial that falls in the selection */ export default class SelectionScoper implements TraversingScoper { rootNode: Node; private start; private end; private startBlock; private startInline; /** * Create a new instance of SelectionScoper class * @param rootNode The root node of the content * @param range The selection range to scope to */ constructor(rootNode: Node, range: Range); /** * Provide a start block as the first block after the cursor */ getStartBlockElement(): BlockElement | null; /** * Provide a start inline as the first inline after the cursor */ getStartInlineElement(): InlineElement | null; /** * Checks if a block completely falls in the selection * @param block The BlockElement to check */ isBlockInScope(block: BlockElement): boolean; /** * Trim an incoming inline. If it falls completely outside selection, return null * otherwise return a partial that represents the portion that falls in the selection * @param inline The InlineElement to check */ trimInlineElement(inline: InlineElement | null): InlineElement | null; }