UNPKG

json-joy

Version:

Collection of libraries for building collaborative editing apps.

27 lines (26 loc) 1.47 kB
import type { Peritext } from '../../../../json-crdt-extensions'; import type { Point } from '../../../../json-crdt-extensions/peritext/rga/Point'; import type { Rect } from '../../../web/types'; import type { PeritextUiApi, UiLineEdge, UiLineInfo } from './types'; export declare class UiHandle { readonly txt: Peritext; readonly api: PeritextUiApi; constructor(txt: Peritext, api: PeritextUiApi); protected point(pos: number | Point<string>): Point<string>; /** * Finds the position of the character at the given point (position between * characters). The first position has index of 0. Have to specify the * direction of the search, forward or backward. * * @param point The index of the character in the text, or a {@link Point}. * @param fwd Whether to find the location of the next character after the * given {@link Point} or before, defaults to `true`. * @returns The bounding rectangle of the character at the given index. */ getPointRect(pos: number | Point<string>, right?: boolean): Rect | undefined; pointX(pos: number | Point<string>): [x: number, rect: Rect] | undefined; findPointAtX(targetX: number, line: UiLineInfo): Point<string>; getLineEnd(pos: number | Point<string>, right?: boolean): UiLineEdge | undefined; getLineInfo(pos: number | Point<string>): UiLineInfo | undefined; getNextLineInfo(line: UiLineInfo, direction?: 1 | -1): UiLineInfo | undefined; }