Quill 2 losing data with innerHTML and getting too many breaklines.
See original GitHub issueI’ve upgraded Quill 1 to 2 in my project and I’m persisting and retrieving the data as HTML with this.quill.root.innerHTML
so I could keep the previous data, but I’m getting so much complains about old data being lost, specially lists. I’m debugging now, searching the causes, until now I’ve found that <p>
tags are generating <br>
tags and so <br>
are getting <p>
too, if I save many times it gets bigger and bigger.
I’ll try to keep this updated.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
<pre> tag loses line breaks when setting innerHTML in IE
Setting innerHTML fires up an HTML parser, which ignores excess whitespace including hard returns. If you change your method to include the ...
Read more >Strip HTML Tags in JavaScript - CSS-Tricks
Because strip_tags() does not actually validate the HTML, partial or broken tags can result in the removal of more text/data than expected.
Read more >Problem with the line break — DataTables forums
It is about editing the editor.quill.js file by changing these lines. get: function ( conf ) { return conf._quill.root.innerHTML; },.
Read more >Element.innerHTML - Web APIs | MDN
The Element property innerHTML gets or sets the HTML or XML markup contained within the element.
Read more >What is the Disadvantage of using innerHTML in JavaScript
Where the return value represents the text content of the HTML element. It allows JavaScript code to manipulate a website being displayed. More ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
As a side-note, if you’re going to take this approach (which I still don’t advise - you should work with ops to retain true semantics), you may be interested in
quill.getSemanticHTML
Sorry, I was thinking of the clipboard:
(This is basically reusing Quill’s ability to parse HTML from the clipboard, which allows for things like different kinds of lists)