فهرست منبع

fix: 修正 toolbar keys - strikeThrough 改 through,删除无效 mergeCells

wangEditor 5 把删除线菜单命名为 'through'(不是 strikeThrough),
mergeCells 不是注册菜单。改用正确的 key 让所有按钮正常渲染并可点击。
Developer 4 هفته پیش
والد
کامیت
71efdec605
2فایلهای تغییر یافته به همراه38 افزوده شده و 3 حذف شده
  1. BIN
      dist.zip
  2. 38 3
      src/components/editor/index.vue

BIN
dist.zip


+ 38 - 3
src/components/editor/index.vue

@@ -95,9 +95,44 @@ export default {
                 mode: 'default'
             })
 
-            // 工具栏:不指定 toolbarKeys,使用 wangEditor 5 默认全部已注册菜单
-            // (basic-modules + list-module + table-module + upload-image-module + code-highlight 等)
-            const toolbarConfig = {}
+            // 工具栏:列出 wangEditor 5 已注册的全部有效菜单 key
+            // 注:wangEditor 把删除线菜单命名为 "through","mergeCells" 不是注册菜单
+            const toolbarConfig = {
+                toolbarKeys: [
+                    'undo', 'redo',
+                    '|',
+                    'headerSelect',
+                    'bold', 'italic', 'underline', 'through',
+                    'code', 'sub', 'sup',
+                    '|',
+                    'color', 'bgColor',
+                    '|',
+                    'fontSize', 'fontFamily',
+                    'lineHeight',
+                    '|',
+                    'justifyLeft', 'justifyCenter', 'justifyRight', 'justifyJustify',
+                    '|',
+                    'bulletedList', 'numberedList',
+                    'indent', 'delIndent',
+                    '|',
+                    'insertImage', 'uploadImage', 'deleteImage', 'editImage',
+                    '|',
+                    'insertTable', 'tableFullWidth', 'deleteTable',
+                    'insertTableRow', 'deleteTableRow',
+                    'insertTableCol', 'deleteTableCol',
+                    'tableHeader',
+                    '|',
+                    'insertLink', 'editLink', 'unLink',
+                    '|',
+                    'blockquote', 'codeBlock', 'todo',
+                    '|',
+                    'divider', 'splitLine', 'clearStyle',
+                    '|',
+                    'emotion',
+                    '|',
+                    'fullScreen', 'preview'
+                ]
+            }
 
             this.toolbar = createToolbar({
                 editor: this.editor,