Edit: almost finished, it contains some dirty hacks like settimeout but it works how it should in my opinion. Only thing left is text align when a <p> or <li> is not selected(<b> selection as example).
Currently trying to make the content editable output the same code for all browsers, tried a million methods, this one seems the best so far. Next thing I'm adding will be <br><br> to <p> conversion so a white line between two parts of text means a paragraph.
Currently contenteditable is a nightmare it seems, <div> on enter for Chrome <p> on enter for IE <br> on enter for firefox
So wanted to try making it work the same across all browsers, my cms requires this functionality since the live preview needs to update on every keypress and the live preview html code needs to be the same across all browsers.
Question
Seahorsepip Veteran
http://jsfiddle.net/827jy7ao/102/
Edit: almost finished, it contains some dirty hacks like settimeout but it works how it should in my opinion. Only thing left is text align when a <p> or <li> is not selected(<b> selection as example).
Currently trying to make the content editable output the same code for all browsers, tried a million methods, this one seems the best so far.
Next thing I'm adding will be <br><br> to <p> conversion so a white line between two parts of text means a paragraph.
Currently contenteditable is a nightmare it seems,
<div> on enter for Chrome
<p> on enter for IE
<br> on enter for firefox
So wanted to try making it work the same across all browsers, my cms requires this functionality since the live preview needs to update on every keypress and the live preview html code needs to be the same across all browsers.
Link to comment
Share on other sites
7 answers to this question
Recommended Posts