Is this normal?
It seems grabbing the innerHTML results in unneeded <p><br></p> spacing wherever there is blank line. I can filter it out for now, but is it an issue to address in Quill?
tnx
That is needed because otherwise you could not put your cursor into the empty line, the browser would ignore it.
I fixed it in the editor CSS. By changing the p tag to have a sufficient margin-bottom, it makes it unnecessary for the user to enter a blank line for the sake of visual separation. It is naturally visually spaced out. Which is actually correct way to do it from a DTP/typography approach.
</p>
// margin-bottom
<p>
instead of
</p>
<p><br></p>
<p>
maybe an adjustment that can be made to the Quill theme css
@gaborsar is correct and I elaborated more on this here. CSS could work but I'm not sure this is a robust solution in all browsers--though this is also moot because of the structure constraints I described.
string.replace("<p><br></p>", "");
Thats all I have to say.
Hi, is it posible (and how can be done) to remove <br> and to put <br/> ?
Thanks.
<br> vs <br/> is an HTML5 vs XHTML thing nothing to do with Quill. Take a look into doctype for more info.
Is there a way to make it so that each paragraph is separate? People shouldn't be separating paragraphs with an empty paragraph/br element in between. Should I just give a margin-bottom to all paragraphs?
I think that the correct behaviour should be to not create adjacent <p> tags unnecessarily. <p> tags don't copy paste across text editors well and <p> tag top/bottom margin in the editing experience is unlike most text editors users are used to. A new line should just take you to the next line. That is, insert a <br/> tag, not a new <p></p> tag with a <br/> tag. Editing should be as close to the rendered output as possible (It is a WYSIWYG after all), so adding margins on <p> tags in the rendered output but not the editor is probably a poor decision.
What am I missing?
Finally found solution to this and many related issues. https://github.com/quilljs/quill/issues/1379#issuecomment-396114612
string.replace("<p><br></p>", "");
Thats all I have to say.
That would only replace the first instance of <p><br></p>
See https://gomakethings.com/how-to-replace-a-section-of-a-string-with-another-one-with-vanilla-js/#replacing-multiple-strings
Most helpful comment
string.replace("<p><br></p>", "");Thats all I have to say.