Bläddra i källkod

修复quill编辑focus
bug

chenxiong 3 år sedan
förälder
incheckning
93f014b60a
1 ändrade filer med 10 tillägg och 4 borttagningar
  1. 10 4
      src/components/Editor/index.vue

+ 10 - 4
src/components/Editor/index.vue

@@ -148,6 +148,7 @@ export default {
     init() {
       const editor = this.$refs.editor;
       this.Quill = new Quill(editor, this.options);
+      console.log(this.Quill)
       // 如果设置了上传地址则自定义图片上传事件
       if (this.uploadUrl) {
         let toolbar = this.Quill.getModule("toolbar");
@@ -172,10 +173,10 @@ export default {
 
       this.Quill.enable(false);
       this.Quill.pasteHTML(this.currentValue);
-      this.$nextTick(function() {
-        this.Quill.blur();
-        this.Quill.enable(true);
-      });
+      // this.$nextTick(function() {
+      //   this.Quill.blur();
+      //   this.Quill.enable(true);
+      // });
       this.Quill.on("text-change", (delta, oldDelta, source) => {
         const html = this.$refs.editor.children[0].innerHTML;
         const text = this.Quill.getText();
@@ -191,6 +192,11 @@ export default {
       this.Quill.on("editor-change", (eventName, ...args) => {
         this.$emit("on-editor-change", eventName, ...args);
       });
+      
+      editor.onclick=() => {
+        this.Quill.enable(true)
+        this.Quill.focus();
+      }
     },
     imageChange(param, type) {
       this.$upload