quill icon indicating copy to clipboard operation
quill copied to clipboard

Copying and pasting individual H1 tags will not work

Open soccerloway opened this issue 5 years ago • 1 comments

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

  1. Visit https://codepen.io/quill/pen/QxypzX.
  2. Type some words in and format them to header.
  3. 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

soccerloway avatar Nov 29 '19 03:11 soccerloway

I found it caused by the code in quilljs core/editor.js: image 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.

soccerloway avatar Nov 29 '19 03:11 soccerloway

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 11:04 quill-bot