import { Subject } from "rxjs"; import { type AttributesObject, type DataBaseNode, type JSONNode, BlockDataElement, BlockyDocument, CursorState, State } from "../data"; import Delta from "quill-delta-es"; import { Block } from "../block/basic"; import { BlockRegistry } from "../registry/blockRegistry"; import { type IdGenerator } from "../helper/idHelper"; export interface IEditorStateInitOptions { userId: string; document: BlockyDocument; initVersion?: number; blockRegistry?: BlockRegistry; idGenerator?: IdGenerator; } /** * This class is used to store all the states * used to render the editor. Including: * * - Document tree * - Cursor * - Instances of blocks * */ export declare class EditorState extends State { #private; readonly domMap: Map; readonly blocks: Map; readonly newBlockCreated: Subject; readonly blockWillDelete: Subject; readonly blockRegistry: BlockRegistry; readonly idGenerator: IdGenerator; readonly dispose$: Subject; silent: boolean; constructor(options: IEditorStateInitOptions); getBlockElementById(id: string): BlockDataElement | undefined; containsBlockElement(id: string): boolean; isTextLike(node: DataBaseNode): boolean; createTextElement(delta?: Delta | undefined, attributes?: AttributesObject, children?: DataBaseNode[]): BlockDataElement; setDom(blockId: string, dom: HTMLElement): void; /** * Split cursor states into multiple states crossing the document. */ splitCursorStateByBlocks(state: CursorState): CursorState[]; toJSON(): JSONNode; dispose(): void; } export declare class NodeTraverser { #private; readonly state: EditorState; constructor(state: EditorState, beginNode: DataBaseNode); peek(): DataBaseNode | null; next(): DataBaseNode | null; }