quill icon indicating copy to clipboard operation
quill copied to clipboard

Drag and drop of external text preserves original styling (whereas copy/paste does the correct sanitizing)

Open robbendavid opened this issue 2 years ago • 3 comments

Steps for Reproduction

  1. Visit https://codepen.io/robbendavid/pen/wvOMyZV
  2. Use your mouse to select a part of line 1 and line 2, and drag it into the editor.

Expected behavior:

The content gets sanitized (just as copy/paste would have done).

Actual behavior:

The styling (in this case the margins) are preserved

Platforms:

Windows 10 Chrome 120.0.6099.72

Version:

1.3.7

robbendavid avatar Jan 04 '24 15:01 robbendavid

Dealing with the same problem. When I drop texts in the editor, the formats retain their font properties. I use Quill 2.0.0 and even-though have configured the registry to exclude formats/font(like using formats:[] white list in Quill 1.3.7). It seems that Quill's handle and support with the drop event are inadequate. Additionally, the editor won't take the last insert location into account if you use a different method, such as a custom function to handle drop event.

hiahiahyj avatar Feb 12 '24 05:02 hiahiahyj

@hiahiahyj Can you reproduce in playground?

luin avatar Feb 12 '24 08:02 luin

@luin Sure. This problem seems to be inconsistent in the playground with my local electron app, but it can basically reproduce part of the problem. In the playground link I provided, if you are in a Mac Chrome environment, the text "drag me" that you provided will not cause any problems. The problem is that when dragging text from applications such as Microsoft Word or WPS, even if I do not register the font module, The font size can exceed the limit.

Here is a screenshot: image

Playground Link: playground

Also, I recommend the team to check out https://v2.quilljs.com/playground/ The V2 demo version on the official website loads two versions, 2.0.0 and 1.3.6, but the one that actually works is 1.3.6. I tried using deprecated formats configuration inside and it still works.

hiahiahyj avatar Feb 12 '24 10:02 hiahiahyj