Fix white spaces not being preserved when pasted into editor
Bug addressed by this PR:
- Go to https://quilljs.com/playground/snow
- Type "1 2" (note the consecutive spaces in the middle)
- Select all text in the editor
- Copy and paste
Expected: content doesn't change Actual: content becomes "1 2". Only one space in the middle.
This PR fixed the issue with two changes:
-
Quill#getSemanticHTML()now exportswhite-spacestyle when white spaces may be collapsed. E.g. with this PR, the output html of the about content would become<span style="white-space: pre-wrap">1 2</span>instead of just1 2. This change makes sure that we provide enough information to the target application where the content is pasted into. E.g. before this PR, pasting the above content to Google Docs will lose the spaces. -
Clipboard#convert()now respectswhite-spacestyle besidespretag. Browsers and applications (e.g. Google Docs) may addwhite-spacestyle for elements that need to preserve whitespaces. Before this change, spaces will be collapsed inClipboard#convert(). To test:- Type "hello world" into Google Docs
- Copy all text from Google Docs
- Paste into a Quill editor
- Make sure spaces between the two words are preserved
Should also fix #4108
Is this the issue where the leading white space inside of my html p tag is not being preserved when using quill.clipboard.convert. Cuz this is the issue that im facing