wangeditor

  • Version 4.7.15
  • Published
  • 2.77 MB
  • 3 dependencies
  • MIT license

Install

npm i wangeditor
yarn add wangeditor
pnpm add wangeditor

Overview

wangEditor - 轻量级 web 富文本编辑器,配置方便,使用简单,开源免费

Index

Classes

class Editor

class Editor {}

    constructor

    constructor(
    toolbarSelector: DomElementSelector,
    textSelector?: DomElementSelector
    );
    • 构造函数

      Parameter toolbarSelector

      工具栏 DOM selector

      Parameter textSelector

      文本区域 DOM selector

    property $

    static $: (selector: DomElementSelector) => DomElement<DomElementSelector>;

      property $textContainerElem

      $textContainerElem: DomElement<DomElementSelector>;

        property $textElem

        $textElem: DomElement<DomElementSelector>;

          property $toolbarElem

          $toolbarElem: DomElement<DomElementSelector>;

            property BtnMenu

            static BtnMenu: typeof BtnMenu;

              property change

              change: Change;

                property cmd

                cmd: CommandAPI;

                  property config

                  config: ConfigType;

                    property disable

                    disable: Function;
                    • 禁用api

                    property DropList

                    static DropList: typeof DropList;

                      property DropListMenu

                      static DropListMenu: typeof DropListMenu;

                        property enable

                        enable: Function;
                        • 启用api

                        property globalCustomMenuConstructorList

                        static globalCustomMenuConstructorList: MenuListType;

                          property globalPluginsFunctionList

                          static globalPluginsFunctionList: pluginsListType;

                            property highlight

                            highlight: any;

                              property history

                              history: History;

                                property i18next

                                i18next: any;

                                  property id

                                  id: string;

                                    property isCompatibleMode

                                    isCompatibleMode: boolean;

                                      property isComposing

                                      isComposing: boolean;

                                        property isEnable

                                        isEnable: boolean;

                                          property isFocus

                                          isFocus: boolean;

                                            property menus

                                            menus: Menus;

                                              property onSelectionChange

                                              onSelectionChange: SelectionChange;

                                                property Panel

                                                static Panel: typeof Panel;

                                                  property PanelMenu

                                                  static PanelMenu: typeof PanelMenu;

                                                    property pluginsFunctionList

                                                    pluginsFunctionList: pluginsListType;

                                                      property selection

                                                      selection: SelectionAndRangeAPI;

                                                        property textElemId

                                                        textElemId: string;

                                                          property textSelector

                                                          textSelector?: DomElementSelector;

                                                            property toolbarElemId

                                                            toolbarElemId: string;

                                                              property toolbarSelector

                                                              toolbarSelector: DomElementSelector;

                                                                property Tooltip

                                                                static Tooltip: typeof Tooltip;

                                                                  property txt

                                                                  txt: Text;

                                                                    property zIndex

                                                                    zIndex: ZIndex;

                                                                      method beforeDestroy

                                                                      beforeDestroy: (fn: Function) => Editor;
                                                                      • 提供给用户添加销毁前的钩子函数

                                                                        Parameter fn

                                                                        钩子函数

                                                                      method create

                                                                      create: () => void;
                                                                      • 创建编辑器实例

                                                                      method destroy

                                                                      destroy: () => void;
                                                                      • 销毁当前编辑器实例

                                                                      method fullScreen

                                                                      fullScreen: () => void;
                                                                      • 将编辑器设置为全屏

                                                                      method initSelection

                                                                      initSelection: (newLine?: boolean) => void;
                                                                      • 初始化选区

                                                                        Parameter newLine

                                                                        新建一行

                                                                      method registerMenu

                                                                      static registerMenu: (key: string, Menu: any) => void;
                                                                      • 自定义添加菜单

                                                                        Parameter key

                                                                        菜单 key

                                                                        Parameter Menu

                                                                        菜单构造函数

                                                                      method registerPlugin

                                                                      static registerPlugin: (name: string, options: RegisterOptions) => void;
                                                                      • 自定义添加插件

                                                                        Parameter name

                                                                        插件的名称

                                                                        Parameter options

                                                                        插件的选项

                                                                      method scrollToHead

                                                                      scrollToHead: (id: string) => void;
                                                                      • 滚动到指定标题锚点

                                                                        Parameter id

                                                                        标题锚点id

                                                                      method unFullScreen

                                                                      unFullScreen: () => void;
                                                                      • 将编辑器退出全屏

                                                                      Type Aliases

                                                                      type DropListConf

                                                                      type DropListConf = {
                                                                      title: string;
                                                                      list: DropListItem[];
                                                                      type: string;
                                                                      clickHandler: (value: DropListItem['value']) => void;
                                                                      width: number | 100;
                                                                      };

                                                                        type DropListItem

                                                                        type DropListItem = {
                                                                        $elem: DomElement;
                                                                        value: string;
                                                                        };

                                                                          type PanelConf

                                                                          type PanelConf = {
                                                                          width: number | 0;
                                                                          height: number | 0;
                                                                          tabs: PanelTabConf[];
                                                                          setLinkValue?: ($container: DomElement, type: string) => void;
                                                                          };

                                                                            type PanelTabConf

                                                                            type PanelTabConf = {
                                                                            title: string;
                                                                            tpl: string;
                                                                            events: TabEventConf[];
                                                                            };

                                                                              type TooltipConfItemType

                                                                              type TooltipConfItemType = {
                                                                              $elem: DomElement;
                                                                              onClick: Function;
                                                                              };

                                                                                Package Files (5)

                                                                                Dependencies (3)

                                                                                Dev Dependencies (62)

                                                                                Peer Dependencies (0)

                                                                                No peer dependencies.

                                                                                Badge

                                                                                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/wangeditor.

                                                                                • Markdown
                                                                                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/wangeditor)
                                                                                • HTML
                                                                                  <a href="https://www.jsdocs.io/package/wangeditor"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>