Missing br tags

I’m serializing the content. After the doc is serialized, the br tags that are inserted when Enter is used are missing.

Steps I followed. In the ordered list, I used shift-enter to get into new line (this used insertBreak). And in this new line, clicking Enter takes us to new list item and then backspacing will remove the item number. But the line that was empty above this, which should Ideally have br is missing. How do I retain those breaks?

The extra <br> tags inserted on empty lines inside the editor are just for presentation purposes (to fix some editing issues and prevent the browser from collapsing the blocks). They are not part of the document. If you really want them in your serialized output (which suggests you’re using empty blocks for spacing, which isn’t a very semantic approach), you’ll have to define your own serializer logic (or patch up the output from the DOMSerializer).

1 Like

Can u please suggest what would be the best way to maintain spacing?