Open jamesfriedal opened 7 years ago
how bout if you listen to keyup and preventDefault() if the keycode is 13 (enter)? else run your input handler. If you need to retain the carriage returns in your textarea, maybe you could split by the carriage return first, then loop that array and run your code ... then finally join the carriage return array
I'm using a content editable div.
Every time the user writes @ or # the following word is wrapped in span tags and becomes blue (like twitter). I'm making use of textrange module to remember wherer the caret is as the innerHTML gets wiped each time.
It works absolutely perfectly, except from enter press in the content editable div. it breaks.
The same issue was raised in a comment by petya petrov here: https://stackoverflow.com/questions/5595956/replace-innerhtml-in-contenteditable-div
Code posted Below