自定义菜单

配置菜单

编辑器创建之前,可使用 editor.config.menus 定义显示哪些菜单和菜单的顺序。

<div id="div1">
    <p>欢迎使用 wangEditor 编辑器</p>
</div>

<script type="text/javascript" src="//unpkg.com/wangeditor/dist/wangEditor.min.js"></script>
<script type="text/javascript">
    const E = window.wangEditor
    const editor = new E('#div1')

    // 配置菜单栏,删减菜单,调整顺序
    editor.config.menus = [
        'bold',
        'head',
        'link',
        'italic',
        'underline'
    ]

    editor.create()
</script>

所有菜单

默认情况下会显示所有的菜单,配置如下:

// 默认情况下,显示所有菜单
editor.config.menus = [
    'head',
    'bold',
    'fontSize',
    'fontName',
    'italic',
    'underline',
    'strikeThrough',
    'indent',
    'lineHeight',
    'foreColor',
    'backColor',
    'link',
    'list',
    'justify',
    'quote',
    'emoticon',
    'image',
    'video',
    'table',
    'code',
    'splitLine',
    'undo',
    'redo',
]
Copyright © wangEditor (2020 - present) all right reserved,powered by GitbookFile Modify: 2020-10-21 16:30:01

results matching ""

    No results matching ""