UNPKG

json-joy

Version:

Collection of libraries for building collaborative editing apps.

35 lines (34 loc) 1.32 kB
import { ValueSyncStore } from '../../../util/events/sync-store'; import type { Printable } from 'tree-dump'; import type { UiLifeCycles } from '../types'; import type { DomController } from './DomController'; /** * Controller for handling text selection and cursor movements. Listens to * naive browser events and translates them into Peritext events. */ export declare class CursorController implements UiLifeCycles, Printable { readonly dom: DomController; readonly caretId: string; private readonly _cursor; constructor(dom: DomController); /** The position where user started to scrub the text. */ protected selAnchor: number; /** * String position at coordinate, or -1, if unknown. */ protected posAtPoint(x: number, y: number): number; /** -------------------------------------------------- {@link UiLifeCycles} */ start(): () => void; readonly focus: ValueSyncStore<boolean>; private readonly onFocus; private readonly onBlur; private x; private y; readonly mouseDown: ValueSyncStore<boolean>; private readonly onMouseDown; private readonly onMouseMove; private readonly onMouseUp; private onKeyDown; /** ----------------------------------------------------- {@link Printable} */ toString(tab?: string): string; }