json-joy
Version:
Collection of libraries for building collaborative editing apps.
13 lines (12 loc) • 538 B
TypeScript
import type { Peritext } from '../../../json-crdt-extensions';
import { type Patch } from '../../../json-crdt-patch';
import type { Range } from '../../../json-crdt-extensions/peritext/rga/Range';
/**
* Given an undo/redo patch/batch, calculates a good cursor position to place
* the cursor after the patch is applied, so that the user can continue typing
* from the same logical position.
*
* @param patch Undo/Redo patch
* @returns Range
*/
export declare const placeCursor: (txt: Peritext, batch: Patch[]) => Range | undefined;