json-joy
Version:
Collection of libraries for building collaborative editing apps.
25 lines (24 loc) • 954 B
TypeScript
import { Block } from './Block';
import { Range } from '../rga/Range';
import type { Stateful } from '../types';
import type { Printable } from 'tree-dump/lib/types';
import type { Peritext } from '../Peritext';
import type { Point } from '../rga/Point';
import type { PeritextMlElement } from './types';
/**
* A *fragment* represents a structural slice of a rich-text document. A
* fragment can be bound to a specific range of text contents, however it
* always constructs a tree of {@link Block}s, which represent the nested
* structure of the text contents.
*/
export declare class Fragment<T = string> extends Range<T> implements Printable, Stateful {
readonly txt: Peritext<T>;
readonly root: Block<T>;
constructor(txt: Peritext<T>, start: Point<T>, end: Point<T>);
toJson(): PeritextMlElement;
toString(tab?: string): string;
hash: number;
refresh(): number;
private insertBlock;
protected build(): void;
}