kindeditor.d.ts 1.1 KB
declare module "kindeditor" {
  namespace KindEditor {
    interface KindEditorOptions {
      items?: string[];
      allowFileManager?: boolean;
      width?: string | number;
      height?: string | number;
      minWidth?: number;
      minHeight?: number;
      themeType?: "default" | "simple";
      resizeType?: 0 | 1 | 2;
      langType?: string;
      filterMode?: boolean;
      urlType?: string;
      newlineTag?: "p" | "br";
      pasteType?: 0 | 1 | 2 | 3;
      afterChange?: (html: string) => void;
      afterCreate?: () => void;
    }

    interface KindEditorEditor {
      html(html?: string): string;
      sync(): void;
      loadPlugin(name: string, callback: () => void): void;
      remove(): void;
      destroy(): void;
    }

    interface KindEditorStatic {
      create(
        element: string | HTMLElement,
        options?: KindEditorOptions,
      ): KindEditorEditor;
      createEditor(
        element: string | HTMLElement,
        options?: KindEditorOptions,
      ): KindEditorEditor;
      version: string;
    }
  }

  const KindEditor: KindEditorStatic;
  export default KindEditor;
}