npm.io
6.0.1 • Published 1 week ago

@wangeditor-next/editor

Licence
MIT
Version
6.0.1
Deps
0
Vulns
0
Weekly
0
Stars
820

wangEditor editor

English

开源 Web 富文本编辑器,开箱即用,配置简单。支持 JS Vue React 。

体积优化(按需模块)

默认入口 @wangeditor-next/editor 会自动注册全部内置模块(表格、上传、代码高亮等)。 如果业务只用到部分能力,建议使用同包轻量入口 @wangeditor-next/editor/core。 该入口不会自动注册内置模块,且不包含上传运行时代码;如需二次开发上传能力,可从 @wangeditor-next/editor/upload 引入 createUploader

import { createEditorFactory } from '@wangeditor-next/editor/core'
import basicModules from '@wangeditor-next/basic-modules'
import wangEditorListModule from '@wangeditor-next/list-module'

const factory = createEditorFactory({
  // tiptap-like:按 extensions 组合功能
  extensions: [...basicModules, wangEditorListModule],
  toolbarConfig: {
    toolbarKeys: [
      'headerSelect',
      'bold',
      'italic',
      '|',
      'bulletedList',
      'numberedList',
      '|',
      'undo',
      'redo',
    ],
  },
})

const { editor, toolbar } = factory.create({
  editor: {
    selector: '#editor',
    config: {
      hoverbarKeys: {},
    },
  },
  toolbar: {
    selector: '#toolbar',
  },
})
import { createUploader } from '@wangeditor-next/editor/upload'

交流

Keywords