slab / quill

Quill is a modern WYSIWYG editor built for compatibility and extensibility
https://quilljs.com
BSD 3-Clause "New" or "Revised" License
43.34k stars 3.37k forks source link

nbsp characters are somehow trimmed from HTML which is set #4261

Open memarko opened 3 months ago

memarko commented 3 months ago

I found out that quill editor strips out   html tags if there is new line character inside.

Steps for Reproduction

I have HTML: <p><span>&nbsp;&nbsp;&nbsp;</span>Test</p> and <p><span>&nbsp;&nbsp;&nbsp;\r\n</span>Test</p> \r\n are non printable characters

Quill converts first html to: ---Test where space is here shown as '-'.

And second one to: Test Which does not have any space before Test.

Platforms:

Browser is Edge version: 126.0.2592.61, OS is Windows 11

Version: Quill.version = '2.0.2'

Workaround: The workaround is to remove new line character to each &nbsp; so: htmlString = htmlString.replaceAll("&nbsp;\n", "&nbsp;").replaceAll("\u00a0\n", "\u00a0")