I have a contenteditable <p> tag
<p id="maincontent" class="conted" spellcheck="false" contenteditable="true"></p>
And I have a function that insert HTML at the caret location.
Sometimes I want to add a breakline using that function. I could then insert a <br/> tag
But in Chromium browsers, the <br/>
tag doesnt break line on the first line of a content editable div.
<p id="maincontent" class="conted" spellcheck="false" contenteditable="true">blabla this is my first line<br/></p>
Adding <br/> tag
doesnt break line on first line
<p id="maincontent" class="conted" spellcheck="false" contenteditable="true">blabla this is my first line<div>this is my second line.<br/></div<</p>
But it does on every other line.
tag followed by a zero-width space character, encapsuled into a non-contenteditable span tag : . But then it prevents the user from returning to the upperline using backspace – Alectrona Jun 25 '20 at 06:38