Hacker News new | ask | show | jobs
by CGamesPlay 25 days ago
There is contenteditable, which is what all these (Wordgard, ProseMirror) are fundamentally built on. The rest is just the UI, and interop with systems that don't desire arbitrary HTML as input.
3 comments

While these use contenteditable, it's not accurate to say they're just contenteditable plus some UI and interop.

None of these modern editors (Wordgard, ProseMirror, Lexical, Slate) use contenteditable for the document model. Rather, they have their own internal document model and use contenteditable as a kind of input layer where the editor monitors what the browser does, then translates that into actual edits.

Early editors like FCKEditor and TinyMCE were only wrappers around contenteditable. They used the DOM as the real document model, then intercepted certain keypresses and events and "fixed" the behavior when it wasn't correct (e.g. double enter inside a bullet list should switch to paragraph mode).

The result was rife with bugs and inconsistencies, and didn't allow for a proper split between the model and the view (e.g. to represent columns, video embeds, and so on).

I’m not a historian but I think FCKEditor and TinyMCE predated contenteditable. These were solutions wrapping textarea back in the day if my memory serves me.
My memory is fuzzy here, so I may be wrong. But I remember the generation of buggy WYSIWYG editors that preceded ProseMirror, and they were all contenteditable-based. They would typically start by attaching to a textarea, but then replace it with a div.
contenteditable I believe was in IE 5.5 in ~2000, I remember playing with it back then. It landed about the same time as "Outlook Web Access" which is arguably the first SPA, originator of AJAX, and first use of XMLHttpRequest. I think TinyMCE and FCKEditor were a little later.
FCKEditor and TinyMCE were using contenteditable.
> The rest is just the UI

"just contenteditable" is really understating things. contenteditable is a god awful API full of bugs and inconsistencies. Making something reliable on top of it is a very significant amount of work.

For context: my day job for last 2 years has been building a new browser engine from scratch, and I think the contenteditable-based WYSIWYG editor I wrote 15 years ago might have been a harder project (albeit I was lot of less experienced then).

"just the UI"

That's a hell of a "just", as anyone working on such projects will tell you. It's super super hard to get this right.