quill icon indicating copy to clipboard operation
quill copied to clipboard

quill copy paste lost custom quill inline blot format in firefox

Open quilluser opened this issue 7 years ago • 1 comments
trafficstars

create a custom quill inline format to add additional attribute for a custom link, however, copy paste the custom link in firefox lost the additional attribute.

Create a code pen for reproduce: https://codepen.io/anon/pen/NMJPMQ

reproduce step:

  1. open the code pen in firefox: https://codepen.io/anon/pen/NMJPMQ
  2. copy the @TestCustomText from the editor, and paste in the same editor in code pen.
  3. open the developer tool and analyze the html of the pasted text. expected result: <a customtext="{'textAttr':'att1'; 'textAttr2':'att2';}" style="text-decoration:none; color:blue;">@TestCustomText</a> actual result: <span style="color: blue;">@TestCustomText</span> the custom textAttr is lost during copy paste.
    This only happened in Firefox. Edge/Chrome seems fine.

quilluser avatar May 21 '18 21:05 quilluser

You ara can use e.clipboardData.getData('text/html') in onPaste method, for example; ` const Delta = Quill.imports.delta; const ClipboardRoot = Quill.import('modules/clipboard');

class Clipboard extends ClipboardRoot{ onPaste(e){ e.preventDefault() const html = e.clipboardData.getData('text/html'); const delta = this.convert(html) this.quill.updateContents(delta, Quill.sources.USER) } } Quill.register('modules/clipboard', Clipboard, true) `

hippo-m avatar Aug 19 '22 09:08 hippo-m

Quill 2.0 has been released (announcement post) with many changes and fixes. If this is still an issue please create a new issue after reviewing our updated Contributing guide :pray:

quill-bot avatar Apr 17 '24 10:04 quill-bot