import type { VirgoLine } from '../components/virgo-line.js'; import type { TextPoint, VRange, VRangeUpdatedProp } from '../types.js'; import type { BaseTextAttributes } from '../utils/base-attributes.js'; import type { VEditor } from '../virgo.js'; export declare class VirgoRangeService { readonly editor: VEditor; private _vRange; constructor(editor: VEditor); get vRangeProvider(): import("../virgo.js").VRangeProvider | null; get rootElement(): import("../virgo.js").VirgoRootElement; onVRangeUpdated: ([newVRange, sync]: VRangeUpdatedProp) => Promise; getNativeSelection(): Selection | null; getVRange: () => VRange | null; getVRangeFromElement: (element: Element) => VRange | null; getTextPoint(rangeIndex: VRange['index']): TextPoint; getLine(rangeIndex: VRange['index']): readonly [VirgoLine, number]; isVRangeValid: (vRange: VRange | null) => boolean; /** * There are two cases to have the second line: * 1. long text auto wrap in span element * 2. soft break */ isFirstLine: (vRange: VRange | null) => boolean; /** * There are two cases to have the second line: * 1. long text auto wrap in span element * 2. soft break */ isLastLine: (vRange: VRange | null) => boolean; /** * the vRange is synced to the native selection asynchronically * if sync is true, the native selection will be synced immediately */ setVRange: (vRange: VRange | null, sync?: boolean) => void; focusEnd: () => void; focusStart: () => void; selectAll: () => void; focusIndex: (index: number) => void; /** * sync the dom selection from vRange for **this Editor** */ syncVRange: () => void; /** * calculate the dom selection from vRange for **this Editor** */ toDomRange: (vRange: VRange) => Range | null; /** * calculate the vRange from dom selection for **this Editor** * there are three cases when the vRange of this Editor is not null: * (In the following, "|" mean anchor and focus, each line is a separate Editor) * 1. anchor and focus are in this Editor * aaaaaa * b|bbbb|b * cccccc * the vRange of second Editor is {index: 1, length: 4}, the others are null * 2. anchor and focus one in this Editor, one in another Editor * aaa|aaa aaaaaa * bbbbb|b or bbbbb|b * cccccc cc|cccc * 2.1 * the vRange of first Editor is {index: 3, length: 3}, the second is {index: 0, length: 5}, * the third is null * 2.2 * the vRange of first Editor is null, the second is {index: 5, length: 1}, * the third is {index: 0, length: 2} * 3. anchor and focus are in another Editor * aa|aaaa * bbbbbb * cccc|cc * the vRange of first Editor is {index: 2, length: 4}, * the second is {index: 0, length: 6}, the third is {index: 0, length: 4} */ toVRange: (range: Range) => VRange | null; private _applyVRange; } //# sourceMappingURL=range.d.ts.map