quill icon indicating copy to clipboard operation
quill copied to clipboard

clipboard.addMatcher not triggering when pasting an image?

Open rsimon opened this issue 7 months ago • 1 comments

Maybe I'm missing something. But I'm trying to catch the event when a user pastes an image from the clipboard directly into the editor (creating a Base64-encoded inline image.) I'm using the following code to add my clipboard handler:

quill.clipboard.addMatcher(Node.ELEMENT_NODE, (node, delta) => {
  console.log('Pasted', node, delta);
  return delta;
});

Expected behavior:

The console should show the message when the user pastes an image.

Actual behavior:

The method does not trigger when I paste an image. The function does trigger when I paste formatted text (HTML). It does not trigger when I paste unformatted text (which, however, I assume is correct because that would be Node.TEXT_NODE).

I have also tried using the following, but with the same behavior. (Triggered only on formatted text, but not plaintext or image.)

quill.clipboard.addMatcher('*', (node, delta) => {

Platforms:

Chrome, MacOS.

Version:

Quill 2.0.2

rsimon avatar Jul 25 '24 08:07 rsimon