surmon-china / vue-quill-editor

@quilljs editor component for @vuejs(2)
https://github.surmon.me/vue-quill-editor
MIT License
7.38k stars 1.03k forks source link

Triggering clipboard with initial model value #460

Open v1talii-dev opened 3 years ago

v1talii-dev commented 3 years ago

It seems like when a new instance of quill-editor is created it triggers an event on the clipboard. This behavior doesn't happen in the original version of quilljs. I looked into the code and seems like you're using pasteHTML to insert the initial value, which makes it trigger the clipboard.

Context: On my application I'm listening for content that is pasted into the editor so I can clean up the content being pasted, the problem is that every time a new instance of quill-editor is created, it triggers a clipboard event.

Here's a code example:

/// this should be triggered ONLY when a new text is pasted from the clipboard.
quill.clipboard.addMatcher(Node.ELEMENT_NODE, (node, delta) => {
  return new Delta().insert(node.textContent);
});
v1talii-dev commented 3 years ago

@surmon-china