UNPKG

@textbus/xnote

Version:

A high-performance rich text editor that supports multiplayer online collaboration.

39 lines (38 loc) 1.31 kB
import { OutputTranslator } from '@viewfly/platform-browser'; import { ViewOptions } from '@textbus/platform-browser'; import { CollaborateConfig } from '@textbus/collaborate'; import { ComponentStateLiteral, Textbus, TextbusConfig } from '@textbus/core'; import './assets/icons/style.css'; import { RootComponentState } from './textbus/components/_api'; import './textbus/doc.scss'; export interface XNoteCollaborateConfig extends CollaborateConfig { userinfo: { username: string; color: string; id: string; }; } /** * XNote 配置项 */ export interface EditorConfig extends TextbusConfig { /** 默认 HTML 内容*/ content?: string | ComponentStateLiteral<RootComponentState>; /** 协作服务配置 */ collaborateConfig?: XNoteCollaborateConfig; /** 视图配置项 */ viewOptions?: Partial<ViewOptions>; } export declare class Editor extends Textbus { private editorConfig; translator: OutputTranslator; private host; private vDomAdapter; constructor(editorConfig?: EditorConfig); mount(host: HTMLElement): Promise<this>; setContent(content: string | ComponentStateLiteral<RootComponentState>): void; getHTML(): string; private createModel; private createModelFromState; private createModelFromHTML; }