Re:A contentEditable, pasted garbage and caret placement wal...
by nicoburns on Saturday July 24, 2021 @07:40AM
(#27940038)
Believe it or not, it used to be a lot worse. One of my first dev projects was a contenteditable based editor, and this was back in 2008 so I needed to support IE6-8, which had it's own separate API for manipulating selections/ranges and of course a whole bunch of bugs. Firefox's impmentation wasn't much better!
Re:A contentEditable, pasted garbage and caret placement wal...
by busymom0 on Saturday July 24, 2021 @08:23AM
(#27940298)
Yep, I remember running into the IE type edge cases too with contenteditable though I just ended up excluding IE all together as not many people use it now a days anyway. I also remember running into bugs which were logged for Firefox over a decade ago for contenteditable and no one had fixed them.
Undo/redo logic was another nightmare. And copy paste required a ton of clean up before.
Next issue I faced was that if the container element had certain css formatting applied (can't remember which one) then if I hit enter, then backspace won't work. If I remember right, this had something to do with a well reported bug related to pre-wrap, white-space, break-line etc. This was also when I discovered that the content editable would work differently across browsers. This was basically when I dumped content editable and went with a simple textarea and a "fake dummy" hidden textarea used for calculating the size, formatting etc.
https://resumetopdf.com/