When I supply supply a content div which contains a paragraph with trailing line breaks,
then I parse that div according to the demo schema,
then I use the resulting content to create an EditorView,
the HTML produced by the EditorView contains an extra line break
The third break is just there in the editor view to make the second break visible. It isn’t part of the document and you probably shouldn’t worry about it.
@marijn
thank you for your quick reply!
okeydokey, i understand.
however!
the reason this was causing me trouble is that, for my application, i’ve been saving the HTML contents of my editor to my database, then parsing them back in when I want to continue working on my document. this causes the document to slowly accumulate line breaks as I save and refresh.
is it not conventional to save the HTML of my document and read it back in? should I be exclusively saving JSON and reading JSON?
And so is taking the innerHTML from the editor. Run the document through a DOMSerializer instead and save that HTML—that’ll be the actual document representation, rather than whatever the editor needs to display to make browsers behave.
Hi @marijn, I don’t understand why it needs to add a third break. The 2 first breaks are already visible. Adding a third break adds a visual third break which is not what I want (I only want to see 2 breaks).
I wan not able to fix this on my side. The editor keeps adding breaks that are visible.