Open amigup opened 7 months ago
We are experiencing the same issue on 2.0.2.
It can be replicated via the Quill playground:
a a
a a
I believe the issue is related to the html that ends up on the clipboard when copying from the quill editor. If you run
setTimeout(async()=> {
const clipboardContents = await navigator.clipboard.read();
for (const item of clipboardContents) {
if (item.types.includes("text/html")) {
const blob = await item.getType("text/html");
const html = await blob.text()
console.log('html', html);
}
const plainText = await navigator.clipboard.readText();
console.log('plain text', plainText);
}
}, 3000)
Then the html is <meta charset="utf-8">a a
Because spaces are collapsed by default in html, this results in the spaces being collapsed in to a single space.
In comparison, copying the 'same' text from google docs results in
<meta charset="utf-8"><meta charset="utf-8"><b style="font-weight:normal;" id="docs-internal-guid-85e5c22f-7fff-c3b6-313f-b46412c0e719"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">a a</span></b>
With the seemingly important bit being a a
, i.e. using a non-breaking spaces to try and prevent the spaces collapsing.
Note: This still results in a single space when pasted in to the quill editor, the rule seems to be if you have n+1
spaces on the clipboard, then pasting in to the quill editor results in n
spaces
Spacing between words are not being preserved while copying and pasting to a destination app via HTML format.
Steps for Reproduction
Expected behavior: Spacing between word should be preserved on pasting via HTML format
Actual behavior: Spacing between word are not preserved on pasting via HTML format
Platforms: Chrome, windows
Version: Quill version 1.3.1