quill
quill copied to clipboard
quill copy paste lost custom quill inline blot format in firefox
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:
- open the code pen in firefox: https://codepen.io/anon/pen/NMJPMQ
- copy the @TestCustomText from the editor, and paste in the same editor in code pen.
- 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.
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) `
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: