import { DefaultElement } from "../common/type"; interface FileItem { name: string; size: number; source: string; uid: string; } interface LinkItem { link: string; uid: string; } interface TagItem { uid: string; tagName: string; } interface TodoItem { content: string; isFinish: 0 | 1; remindDate?: { repeatMode: 'weekday' | 'weekend' | 'everyday' | 'monthly' | 'noRepeat'; time: number; }; title: string; type: 'expired' | 'todo' | 'incomplete'; uid: string; } interface EditorDto { content: string; files: FileItem[]; link: LinkItem[]; tags: TagItem[]; todos: TodoItem[]; textContent: string; uid: string | undefined; } interface BlockDto { todo: TodoItem; file: FileItem; } interface LeafDto { link: LinkItem; tag: TagItem; } declare class PreviewHelper { private uid; private files; private tags; private link; private textContent; private todos; private serverIdArray; private value; constructor(value: DefaultElement[], uid?: EditorDto['uid']); private transform; private getServerId; /** * 注入服务器 Id */ injectServerId(serverIdArray: string[]): this; /** * 获取 payload 长度 * 用于决定此次请求需要申请多少个 serverId */ getPayloadLen(): number; /** * 获取编辑器预览内容(含解析后的数据) */ getPreview(): EditorDto; /** * 获取序列化后的编辑器内容 */ getEditorContent(): string; /** * 更新 block */ updateBlock(type: T, payload: Partial): this; /** * 更新 leaf */ updateLeaf(mark: T, payload: LeafDto[T]): this; /** * 删除 block */ removeBlock(uid: string): this; /** * 删除 leaf */ removeLeaf(uid: string): this; /** * 获取 textContent */ getTextContent(): string; /** * 获取为序列化的编辑器内容(用作单元测试) */ getValue(): DefaultElement[]; isEmpty(): boolean; /** * 插入 leaf 在顶部 * 如果第一排含有 mark 标记,则在第一排后面插入 leaf ,否则在顶部插入 block 再插入 leaf * @param mark 标记 * @param text 值 * @param id serverId * @param space 多个 leaf 并列时,中间的文本内容,默认为 ' ' */ insertLeafAtTop(mark: T, text: string, id?: string, space?: string): this; } export { PreviewHelper };