I'm trying to copy the innerHTML of a contenteditable div to a javascript variable. When I press enter inside of a contenteditable div, and then copy the innerHTML to a variable I want the text to look like this:
this
is
some
text
Notice the line breaks.
But by default, when you press enter in a contenteditable div this happens to the html.
this <div>is</div> <div>some</div> <div>text</div>
I can acheive the desired behavior by holding shift and pressing enter, but is there a way to set this up so I don't have to hold shift?
Just for reference, I don't want something like this:
this
is
some
text