3 ms·
A good proposal. I'm interested in such a layout system for building an all-included rich text editor. Rich-text editors (like Google Docs and Zoho Writer) are
by lewisjoe 3y ago
A good proposal. I'm interested in such a layout system for building an all-included rich text editor.
Rich-text editors (like Google Docs and Zoho Writer) are inherently layout systems - with editable elements as children. In fact, both those products have implemented their own layout engine (including line-breaks and pagination breaks) to overcome the horror of working with contenteditable divs.
ProseMirror comes close in giving a reasonable level of control and makes it tolerable to work with contenteditable div, but still lacks the level of control needed for implementing page-breaks and complex layouts.
If we could build a layout engine (like the ones in browsers) that can practically run on user-land (in browsers and other platforms), we could eventually land on a cross-platform rich-text editing library with powerful APIs.
- nicoburns 3y agoYou might be interested in the combination of Taffy [0] which handles box-level browser layout (block, flexbox, grid, etc) and Cosmic Text [1] which handles text-level layout and basic text editing functionality. Integrating them into browsers while retaining accessibility could be tricky. But in they're general they're relatively small standalone libraries implementing most of the layout algorithms that browsers implement (although there are currently a few key missing features like laying out "inline-block" items in line with text). [0]: https://github.com/DioxusLabs/taffy https://github.com/DioxusLabs/taffy [1]: https://github.com/pop-os/cosmic-text https://github.com/pop-os/cosmic-text