Hi!
When working on the exemplar-blocks [1], I noticed that the bundle size of an XBlock’s UI jumped 4x after adding TinyMCE for an input field.
Before
vite v8.0.2 building client environment for production...
✓ 3292 modules transformed.
computing gzip size...
../src/card_grid_block/public/cardGridStudent.js 28.15 kB │ gzip: 7.19 kB
../src/card_grid_block/public/Stack-CMSfB8yk.js 286.74 kB │ gzip: 75.12 kB
../src/card_grid_block/public/cardGridStudio.js 580.87 kB │ gzip: 153.31 kB
After
vite v8.0.2 building client environment for production...
✓ 3309 modules transformed.
computing gzip size...
../src/card_grid_block/public/cardGridStudent.js 28.15 kB │ gzip: 7.19 kB
../src/card_grid_block/public/Stack-CMSfB8yk.js 286.74 kB │ gzip: 75.12 kB
../src/card_grid_block/public/cardGridStudio.js 2,291.73 kB │ gzip: 609.56 kB
This got me thinking about a “Paragon Native” text editor. Using the Lexical editor framework, and the code sample from the home page, I ended up with the following PoC.
It does what you see in this image below:
and builds to around ~700 to ~900KB based on the format:
> tsc -b && vite build --mode lib
vite v8.1.5 building client environment for lib...
✓ 29 modules transformed.
computing gzip size...
dist/paragon-rich-text-editor.css 0.64 kB │ gzip: 0.38 kB
dist/paragon-rich-text-editor.js 888.44 kB │ gzip: 233.36 kB
✓ 29 modules transformed.
computing gzip size...
dist/paragon-rich-text-editor.css 0.64 kB │ gzip: 0.38 kB
dist/paragon-rich-text-editor.umd.cjs 668.45 kB │ gzip: 208.71 kB
That’s not exactly “light weight” considering the limited functionality. But additional functionality shouldn’t bloat the size too much as most of Lexical is already in there.
I did a bit of research on prior-art on this topic and end up from an ADR from 2023 with an interesting comment - docs: add TextEditor ADR by connorhaugh · Pull Request #1131 · openedx/paragon · GitHub
That said, it may be interesting if Paragon one day supported its own custom text editor component that didn’t rely on TinyMCE, but instead something like GitHub - facebook/lexical: Lexical is an extensible text editor framework that provides excellent reliability, accessibility and performance. · GitHub.
– @adamstankiewicz
So, I thought it might to be a good idea to pose the question to the community. I have a very limited knowledge on the usage of TinyMCE across the the projects. So at this point, it’s just a curious question from me.
My main thesis - having a custom solution that’s built with Paragon UI elements would be light weight and integrate better as a part of the native application instead of an iframe with it’s own styles like TinyMCE.
exemplar blocks are a set of XBlocks whose UI are build using Paragon and React instead of the traditional Django template and jQuery. ↩︎
