quill
quill copied to clipboard
Copying and pasting individual H1 tags will not work
Copying and pasting individual H1 tags will not work, it just paste the plain text, but when the H1 tag is copied and pasted with other tags, it is really good. This problem only appeared in Quill 2.0.0-dev.x, Quill 1.3.6 does not have this problem.
Steps for Reproduction
- Visit https://codepen.io/quill/pen/QxypzX.
- Type some words in and format them to header.
- Copy part of them and paste to a new line, only plain text in new line, without h tag.
Expected behavior: h tags will be retain in the new line.
Actual behavior: Only plain text in the new line Platforms: Mac OS, chrome Include browser, operating system and respective versions
Version: quill 2.0.0-dev.2
I found it caused by the code in quilljs core/editor.js:
getHTML is called in onCopy, and the return html will be cached in clipboard.
It looks like the author handles inline copying and multi-line copying separately, I haven't figured out what the purpose was.
If I remove the if logic statement, copying and pasting individual h1 tag will work.
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: