collaborative-input
Version:
Collaborative input and textarea bindings to JSON CRDT
22 lines (21 loc) • 994 B
TypeScript
import type { SimpleChange, EditorFacade, Selection } from 'collaborative-editor';
import type { CollaborativeStr } from 'collaborative-editor';
export declare class InputEditor implements EditorFacade {
protected readonly str: () => CollaborativeStr;
protected readonly input: HTMLInputElement | HTMLTextAreaElement;
selection: Selection;
onchange?: (change: SimpleChange[] | void, verify?: boolean) => void;
onselection?: () => void;
constructor(str: () => CollaborativeStr, input: HTMLInputElement | HTMLTextAreaElement);
get(): string;
getLength(): number;
set(text: string): void;
ins(position: number, text: string): void;
del(position: number, length: number): void;
getSelection(): [number, number, -1 | 0 | 1] | null;
setSelection(start: number, end: number, direction: -1 | 0 | 1): void;
protected emitChange(event: InputEvent): void;
private readonly onInput;
private readonly onSelectionChange;
dispose(): void;
}