3 ms·
Ah, the joys of contenteditable HTML elements... Such an under-specified and utterly horrible part of the web specs. I'm sure you had a lot of fun fighting Saf
by dbrgn 3y ago
Ah, the joys of contenteditable HTML elements... Such an under-specified and utterly horrible part of the web specs.
I'm sure you had a lot of fun fighting Safari in general, and also the diverging handling between Chromium and Firefox (for example when pressing the Enter key). Even just changing certain CSS properties on the root editor element will cause the resulting markup on certain key inputs to be different.
I admire that you pulled it off, and hope that you have a big collection of cross-browser integration tests for catching all the regressions that will inevitably happen :) Good luck!
- twsted 3y agoIt uses Prosemirror, which is pretty well tested.
- Turing_Machine 3y agoSafari is actually much better than some when it comes to contenteditable. For one, Safari (along with Chrome, Edge, Android Webview, etc.) supports the plaintext-only attribute for contenteditable, which Firefox does not. That means you don't have to worry about getting some ugly blob of broken HTML pasted into your document.
- dbrgn 3y agoTIL abuot plaintext-only. Thank you, that's very useful.
- Turing_Machine 3y agoYou're welcome. There are some minor inconsistencies (e.g., some browsers add a normal newline when one is pasted in, while others insert a <BR>, which seems like broken behavior to me), but dealing with those inconsistencies is much easier than dealing with random chunks of HTML being pasted in.