-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When a string of multiple "Space" characters is pasted, only one will be displayed #1751
Comments
I can second this issue I am currently using Quill through React Quill, which using pasting on its initial render to set the editor's contents ( https://github.com/zenoamaro/react-quill/blob/master/src/mixin.js#L68) Quill is producing whitespace within HTML when you tab. Given the following example (
hitting tab several times will produce something like this
Whenever we store this strong and try to re-instantiate in a React Quill instance, this text is pasted into Quill through the code line linked above.
I totally agree with @jhchen's explanation in #996 - it makes sense to have this collapsible behavior when pasting HTML, however in this case I just don't want to do that. I also own the string which I am pasting in and can guarantee that all the whitespace it has, should be preserved. One possible solution I could see is to provide a flag for What do you think? |
This issue specifically is caused by the same thing as #1752 so I'll close this as a duplicate. To answer @LFDM's question: Quill makes use of this itself when it initializes wraps HTML in a |
Add this to styles.css
|
Works for spaces, but this prevents the |
My problem was with |
For those who is still suffering from this nasty issue in 2021 O_o: // this module is to workaround a nasty issue with preserving white spaces (they got stripped out):
// https://github.com/quilljs/quill/issues/1752
// https://github.com/quilljs/quill/issues/2459
// https://github.com/quilljs/quill/issues/1751
class PreserveWhiteSpace {
constructor(private quill: any, private options: {}) {
quill.container.style.whiteSpace = "pre-line";
}
}
Quill.register('modules/preserveWhiteSpace', PreserveWhiteSpace); Do not forget to add export const quillModulesBasic: Quill.StringMap = {
imageResize: {
modules: [ 'Resize', 'DisplaySize' ]
},
clickableLink: true,
preserveWhiteSpace: true,
toolbar: [
['bold', 'italic', 'underline', 'strike', 'blockquote'],
... The root cause is in the |
This solution that @jhchen alludes to completely breaks bullet lists and numbered lists in Quill. And it doesn't work if produced HTML is to be used in an email client. |
And this solution prevents users with Firefox on Windows from adding spaces between a char or word entirely. No known workaround. |
#1751 (comment) |
From: mozilla/notes#285
[Affected versions]:
[Affected Platforms]:
[Prerequisites]:
[Steps to reproduce]:
[Expected result]:
[Actual result]:
[Notes]:
The text was updated successfully, but these errors were encountered: