Change/inconsistency in how soft line breaks are rendered in Fabric editor pages

We noticed another issue with pages from the new editor not behaving as expected after converting them to export_view format.
Basically the way a soft line break (shift + enter in the editor) is represented in storage format has changed and this has only been adjusted for in the browser and not in i.e. the export_view format.

Steps to reproduce:

Create/edit a page in both the old and new Confluence editor and follow these steps in the editors:

  1. Type “Paragraph1”
  2. hit Shift+Enter to insert a soft line break
  3. Type “Paragraph2”
  4. Save page

This will result in the following storage format:

Old editor page:

<p>Paragraph1<br /><br /></p>
<p>Paragraph2</p>

Fabric editor page:

<p>Paragraph1<br /></p>
<p>Paragraph2</p>

Note the differing numbers of <br/> tags in the storage format.

When these pages are then rendered to view format in the browser this is the result:
Old editor page browser view:

<p>Paragraph1<br /><br /></p>
<p>Paragraph2</p>

Fabric editor page browser view:

<p data-renderer-start-pos="1">Paragraph1<br><br></p>
<p data-renderer-start-pos="14">Paragraph2</p>

So they effectively do render the same in the Confluence browser view, no problem there.

This is different when converting to export_view format through the REST API, which results in this:

Old editor page export_view:

<p>Paragraph1<br clear="none" /><br clear="none" /></p>
<p>Paragraph2</p>

Fabric editor page export_view:

<p>Paragraph1<br clear="none" /></p>
<p>Paragraph2</p>

Note that the new editor page does not add the second <br> tag here. Virtually all HTML renderers ignore <br> tags if they are the last node in their surrounding block, so from a user perspective there will be additional line breaks between the paragraphs.
This is a problem for our Exporter apps since they now produce output that is visually different from what Confluence shows when exporting a page that is using the new editor.


Bonus bug
When converting a page to the new editor through Confluence this is also not adjusted for. When the “old editor page” from above is converted to the new editor it will keep the same storage format but would now be rendered with an additional break in the Confluence browser view:

<p data-renderer-start-pos="1">Paragraph1<br><br><br></p>
<p data-renderer-start-pos="15">Paragraph2</p>
3 Likes