Hacker News new | ask | show | jobs
by anilgulecha 3498 days ago
[EDIT: Just for reference, the title originally was 'the right way to content manage..']

I'd maybe call this "an" approach, rather than the 'right' approach :)

Already, prosemirror has provided a solid alternative, with things like custom-schemas, which ensure we're no longer in contenteditable-copy/paste hell. There's substance.io and quilljs as well.

Any of these could be the right approach for a particular CMS problem.

3 comments

I just came here to write that I think this is THE right approach for wysiwyg editor. Having a full model of the document tree rather and working from that rather than sanitizing `contenteditable`. I expect this approach to automatically solve many problems that other wysiwyg editors have.
I like and use Draft, but the separation of a document model from contenteditable is a feature of the editor frameworks mentioned above (as well as others like slate) and is not unique to Draft, or this implementation of an editor around Draft.
Prosemirror still uses contenteditable under the hood though. I actually wonder why that is the case.
It handles the more complex (e.g. CJK) input methods. The alternative is a hidden text field and you have to put more effort into emulating the cursor (e.g. up arrow/down arrow). Regularly re-generating the underlying markup removes a large class of edge cases and cross-browser incompatibilities in exchange for not being able to use the browser's native undo. It's still a lot harder than you'd expect but it seems to be working for draft and prosemirror better than my attempt to normalize the cross browser differences and rely on the browser.

P.S. I also came into this thread to endorse Prosemirror.

To be fair "React Draft Wysiwyg" is using contenteditable too, but it also builds a full model of the document.
Thanks your your insightful feedback.
Mostly the 'right approach' depends a lot on the scale of the site(s) you are managing with it when it comes to a CMS. You really start missing forced structure even with a few content managers, let alone 100s of content managers copy/pasting stuff all over the place.
Hi Anil,

I did not said only right approach :)