slab / quill

Quill is a modern WYSIWYG editor built for compatibility and extensibility
https://quilljs.com
BSD 3-Clause "New" or "Revised" License
43.94k stars 3.41k forks source link

No content pasted from Outlook #4051

Open rmonsterlet opened 8 months ago

rmonsterlet commented 8 months ago

Hello,

We use Quill in our application

"quill": "^1.3.7",
"quill-delta": "^5.0.0",
"quill-mention": "^3.1.0",
"ngx-quill": "^21.0.0",

but we have a problem when a user comes to copy/paste formatted text (bulleted list, etc.) from Outlook: Nothing is pasted, but spaces are inserted instead.

We tried to inspect code here, but it's already too late, the content is already removed

class CustomClipboard extends ClipboardModule {
  onPaste(event: ClipboardEvent): void {
  }
}
Quill.register('modules/clipboard', CustomClipboard, true);

Same thing with this.quill.on('text-change', delta => { or this.quill.on('editor-change', delta => {

By inspecting code at runtime, we found that it's in the optimize() function of blots/scroll.ts that our content is deleted

optimize(
    mutations: MutationRecord[],
    context?: { [key: string]: any },
  ): void;
  optimize(mutations = [], context = {}) {
    if (this.batch) return;
    super.optimize(mutations, context);
    if (mutations.length > 0) {
      this.emitter.emit(Emitter.events.SCROLL_OPTIMIZE, mutations, context);
    }
  }

Can you help us find a solution to our problem? If needed we will upload a video of our issue

Thanks in advance.

Steps for Reproduction

  1. Visit quilljs.com
  2. Copy/Paste bullet list content from outlook

Expected behavior: Content is pasted

Actual behavior: Nothing is pasted

Platforms: Chrome latest - All OS

Romain Monsterlet @ Bloomflow

luin commented 8 months ago

Can you reproduce the issue in the playground? What's the content in the clipboard (inspector)?

xavierdecazenove commented 8 months ago

Hello @luin, I'm working with @rmonsterlet.

To clarify a few points:

Although I manage to reproduce the bug all the time, when I try to reproduce the bug on your playground and/or inspector it doesn't happen... here the link

I don't know if this is linked to the fact that we work in Angular?

Would it help if I shared with you the initial error we receive in the console? or maybe screen recording?

I have to admit that @rmonsterlet and I are running out of ideas to continue our research. If you have any leads or questions, we'd really like to hear from you.

luin commented 8 months ago

The playground uses Quill 2.0 and I guess that's the major difference. An reproducible example would be helpful. Or you may try upgrading to Quill 2.0.

rmonsterlet commented 8 months ago

Using Quill v2 was one of the first ideas we came up with. However, you're still in RC and we strongly avoid having to use third-party code in RC. Is there an official release date for v2? We should be updating Angular, but we're not so worried about that as much as whether this RC is viable.

Thank you very much for your feedback

luin commented 8 months ago

We (slab.com) have used v2 for a quite long time and it works good. It makes sense that you want to use a stable version though. The initial plan was 1st, March but I decided to add some more features before a stable release. While I don't have an ETA to share but should be pretty soon.

rmonsterlet commented 8 months ago

This information is very valuable to us, and I think we'll be looking at an Angular and Quill upgrade in the near future. Thanks to you and all the people who contribute to your projects.

Best regards Romain

rmonsterlet commented 8 months ago

@xavierdecazenove anything else to share here ?

xavierdecazenove commented 8 months ago

@luin Here is a screen recording of what's happening: Screen-recording.zip

But still not sure that this is helping. As mentioned, it works using Cmd+Shift+V (end of the recording)

I think to get a reproductible example, it could be great if I can test your playground under the same Quill version as we have: 1.3.7

Thanks for the help

luin commented 8 months ago

I didn't reproduce it in v1's playground: https://v1.quilljs.com/playground/.

xavierdecazenove commented 8 months ago

@luin Yes, I can't reproduce in v1 either... We will continue the investigating in our hand then, and if nothing come up we will try to upgrade version. Thanks for your time!