by lewisjoe · 3y ago · 0 comments
But it comes with its downsides as well. For example cross block selection doesn't work.
If the entire page is one big editable area, then it becomes difficult to embed complex blocks like "kanban views" and calendar.
I guess we should think beyond contenteditable at this point and separate rendering layer from input layer[1] - sort of like how Google Docs has built its editor.
But writing a rich text editor is not just a text-editing problem. It essentially needs you to build a layout engine itself (like webkit) that knows how/when to recalculate and draw the affected parts (render objects) when the rich-text changes. Why? because baking in tables and image-wraps and other complex resizable blocks affect other elements around/after it.
Bottomline: we need a custom built layout engine + text renderer + input handler(that respects accessiblity) + selection handler to build an absolutely powerful rich-text editor. I'd like to start a open source project in this direction.
At Slite I was part of the mobile team, and the editor is using Slate. So to make it work in React Native we had to go for a WebView (similar to what Notion uses), with all the downside it can bring..
I tickled with the possibilty to do a native adapter of Slate, but the fact that it's based on a content editable, makes it complicated to adapt in React Native..
I have the feeling that block approach might fit better a more native integration on mobile. It seems similar to what Craft does, isn't it ?
Would be interesting to see projects going beyond contenteditable for sure!