This is follow up of T121092: Multiple paragraphs in a section causes data loss on restoration
When enter key is pressed inside a content editable, browser behavior differs:
This bug happens if the inserted tag is a section tag. ie p or div. If you do this in Firefox, restoring works fine since it is an br inside paragraph,
Your patch handles the cases of section tags correctly. I tested.
But, having a <div> tag in HTML causes Parsoid to insert the <div> tag in the generated wiki text. And the article published will not have that paragraph break. So the users intention of paragraph break is not accompilished.
<p>first <div>second </div></p>
first <div>second </div>
If the br tag appears inside the HTML , generated wiki text will have paragraph breaks and hence it satisfies users intention.
first second third
Ideally, on enter keys, we should close the <p> and insert a new <p> by disallowing both div, and br creation inside <p> tag
That also means, in translation column it is a new section created with a dummy section in source