Browse Source

!827 fix: 修复 Editor 切换 readonly 时只读状态无效的 bug
Merge pull request !827 from 局外人/fix/editor

芋道源码 3 months ago
parent
commit
6caed15c1a
1 changed files with 16 additions and 0 deletions
  1. 16 0
      src/components/Editor/src/Editor.vue

+ 16 - 0
src/components/Editor/src/Editor.vue

@@ -58,6 +58,16 @@ watch(
     emit('update:modelValue', val)
   }
 )
+watch(
+  () => props.readonly,
+  (val) => {
+    if (val) {
+      editorRef.value?.disable()
+    } else {
+      editorRef.value?.enable()
+    }
+  }
+)
 
 const handleCreated = (editor: IDomEditor) => {
   editorRef.value = editor
@@ -90,6 +100,12 @@ const editorConfig = computed((): IEditorConfig => {
       },
       autoFocus: false,
       scroll: true,
+      EXTEND_CONF: {
+        mentionConfig: {
+          showModal: () => {},
+          hideModal: () => {}
+        }
+      },
       MENU_CONF: {
         ['uploadImage']: {
           server: getUploadUrl(),