Ask HN: Why is working with contenteditable is so hard?

raxrb | 10 points

Lexical

https://lexical.dev/

Tiptap

https://tiptap.dev/

Automerge (any CRDT of your choice)

https://automerge.org/

throwaway888abc | 5 months ago

Because different browsers insert the content in a different fashions. The reliable way to use contenteditable is to intercept keypresses and modify the inner HTML yourself, i.e. use contenteditable only to use the cursor affordance.

tacone | 4 months ago

I am also looking for info on how to work with contenteditable for an extension. So far we've done a mixture of copy/paste and dom manipulation. Each works in some places and not in others. It's very frustrating and there's not a ton of good resources on it.

BWStearns | 5 months ago