import { DOMParser, Node as ProsemirrorNode } from 'prosemirror-model'; import { EditorView } from 'prosemirror-view'; import { IDecoState } from './basic/decoration'; import { IGeneralOption, INodeInfo, InsertOption, IPasteOption, IReplaceOption, IUpdateOption } from './command'; import { SylConfigurator, TSylEventType } from './configurator'; import { Types } from './libs'; import { IModuleType } from './module'; interface ISylApiAdapterOptions { module?: Types.StringMap; content?: string | Types.StringMap; } interface ISetFormatOptions extends Partial { focus?: boolean; } interface IGetHTMLOptions { layerType?: string; mergeEmpty?: boolean; } interface ISetHTMLOptions { allowUndo?: boolean; silent?: boolean; mergeEmpty?: boolean; keepWhiteSpace?: boolean; } interface IGetSelectionInfo extends Types.IRangeStatic { anchor: number; head: number; node?: ProsemirrorNode; } interface ISetSelectionOptions extends Partial { anchor?: number; head?: number; scrollIntoView?: boolean; selectNode?: boolean; } declare type TSylApiCommand = (...args: any[]) => any; interface ISylApiCommand extends Record | undefined> { } declare class SylApi { root: HTMLElement; configurator: SylConfigurator; view: EditorView; domParser: DOMParser; command: ISylApiCommand; constructor(configurator: SylConfigurator, { module, content }: ISylApiAdapterOptions); addCommand: (name: string | null, commandObj: { [key: string]: (...args: any[]) => any; }) => void; private listenBlur; private listenFocus; get length(): number; get isEmpty(): boolean; get text(): string; get isFocused(): boolean; get undoable(): boolean; get redoable(): boolean; get editable(): boolean; get shortcutable(): any; get isDestroy(): boolean; onError(err: Error, args?: any): any; getText(range?: Types.IRangeStatic): string; setFormat(format: Types.StringMap, option?: ISetFormatOptions): void; insert(nodeInfo: INodeInfo | string, index?: InsertOption | number): void; insertText(text: string, format?: Types.StringMap, index?: number | InsertOption): void; insertCard(type: string, attrs?: Types.StringMap, index?: InsertOption | number): void; insertInlineCardWithPara(type: string, attrs: Types.StringMap, index?: InsertOption | number): void; replace(nodeInfo: INodeInfo | string, replaceOption?: IReplaceOption | number): void; replaceCard(type: string, attrs: Types.StringMap, index: number | IReplaceOption): void; delete(index?: number, length?: number, option?: IGeneralOption): void; deleteCard(index: number): void; on(event: TSylEventType, handler: (...args: any[]) => void): void; off(event: TSylEventType, handler: (...args: Array) => void): void; emit(eventName: TSylEventType, ...args: any[]): void; getSelection: () => IGetSelectionInfo; setSelection(config: ISetSelectionOptions): void; blur(): void; enable(): void; disable(): void; enableShortcut(): void; disableShortcut(): void; focus(): void; undo(): boolean; redo(): boolean; uninstall(): void; getContent(): { [key: string]: any; }; setContent(value: Types.StringMap): void; /** * set editor content by `HTML` * `allowUndo` refers to whether to allow undo, the default is false; * `silent` refers to whether to emit the `text-change` event, the default is true; * `mergeEmpty` refers to whether to merge continuous empty

and continuous
. The default is true. * Note that allowUndo must be false when silent is true. */ setHTML(value?: string, options?: ISetHTMLOptions): void; /** * get `HTML content` of editor * `mergeEmpty` refers to whether to merge continuous empty

and continuous
. The default is false. * `layerType` refers to the content configured in `ViewMap` or `layers`, the default is ‘template’ */ getHTML(config?: IGetHTMLOptions): string | undefined; /** * Used to simulate paste behavior to insert content */ pasteContent: (content: string, option?: IPasteOption) => boolean; /** * Trigger events, which can be used for testing or other purposes. */ dispatchEvent: (event: Event) => void; getExistNodes(nodeName: string): import("./command/query").IMappingNode[]; getExistMarks(markName: string): import("./command/query").IMappingNode[]; checkHasContentBefore(pos: number): boolean; update(attrs: Types.StringMap, updateOption: IUpdateOption | number): false | undefined; updateCardAttrs(index: number, attrs: Types.StringMap, updateOption?: Partial): false | undefined; getFormat(range?: Types.IRangeStatic): Types.StringMap; clearFormat(): boolean; nodesBetween(walker: (node: ProsemirrorNode, pos: number, parent: ProsemirrorNode) => boolean | undefined | void, range?: Types.IRangeStatic): void; getCursorNode(): false | { pos: number; node: ProsemirrorNode; }; getShadows(key?: ((spec: Types.StringMap) => boolean) | string, index?: number, length?: number): import("prosemirror-view").Decoration<{ [key: string]: any; }>[]; insertShadow(data: { index?: number; pos?: number; editable?: boolean; shadow: IDecoState['data']['shadow']; spec: IDecoState['data']['spec']; }, inline?: boolean): void; removeShadow(key: string): { index: number; length: number; spec: { [key: string]: any; }; } | undefined; appendShadow(data: { index: number; length: number; attrs?: IDecoState['data']['attrs']; spec: IDecoState['data']['spec']; }, inline?: boolean): void; isActive(type: string): boolean; } export { ISetHTMLOptions, ISylApiAdapterOptions, ISylApiCommand, SylApi, TSylApiCommand };