CroudTech / vue-quill

Quill component for vue
MIT License
121 stars 22 forks source link

Clipboard matcher error #35

Open jscottwillems opened 3 years ago

jscottwillems commented 3 years ago

Im using a clipboard matcher to detect when a user pastes an img into my quill editor. My handler function works as follows:

pasteHandler(node, delta) {
  let imgSrc = delta.ops[0].insert.image;

  //*imgSrc gets sent to an api to be stored and new img src is returned*

  //*once I have the new src from my api res I add the image into my quill instance:*

  this.quillInstance.updateContents(
    new Delta().insert({
      image: `New Image Source`,
    })
  );
},

Everything works as expected and my image is displayed with the new updated source. The problem is I get this error from quill every time:

quill.js?9339:494 Uncaught TypeError: Cannot read properties of undefined (reading 'ops') at Delta.concat (quill.js?9339:494) at eval (quill.js?9339:9097) at NodeList.reduce () at traverse (quill.js?9339:9087) at eval (quill.js?9339:9088) at NodeList.reduce () at traverse (quill.js?9339:9087) at h.convert (quill.js?9339:8959) at h.convert (quill.js?9339:8945) at h.value (quill-paste-smart.js?593d:3)

Nothing breaks but I can't have this error message show up every time someone pastes an image in the editor

Any assistance would be greatly appreciated!