You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1️⃣
We can't provide our own stripped down nodes, since plugins like MarkdownShortcutsPlugin internally hard-depend on default nodes due to using node-related functions like $isCodeNode, or by adding transformers which we can't dependency-inject in the userland like we can inject nodes to the editor config.
So if we want pick some rich text functionality, we need to copypaste and strip down all rich text related plugins and their deps, which is really sadge.
2️⃣
Lexical packages are bundled and minified for production usage, making it really hard to use patch-package on CodeNode for example to strip down language-related code and thus prismjs.
I have a feeling that MarkdownShortcutsPlugin is the most common path for building editor variants users expect, so in the long run I think it makes sense to make it as barebones as possible in the base package and add the ability to extend it if needed.
Is there a way to monkey-patch prismjs in CodeNode in the userland in case user wants it, otherwise strip CodeNode of it by default?
That would probably be the easiest solution to implement.
...
Here's a dumb stripdown of CodeNode, because I don't understand what this does and why it requires stuff from CodeHighlightNode which is even more dependent on prismjs.
I didn't test it and it feels pretty dumb, but might give some inspiration to someone.
@trueadm sorry for tagging you directly, but I'm really curious how does this look from your pov and wanted to start a conversation somehow, which might not start at all if I don't tag. 😅
I don't see how we could improve tree-shaking and customizability of markdown plugin, in a sense that we might only want to add bold, italic, lists and that's it, without thinking how to dynamically inject all those things from the userland, and whether maintainers want to go that route at all. 🤷♂️
What I miss from lexical after working with it for two weeks+ is the ability to import more low-level stuff as functions instead of copy-pasting them from playground or lexical repo. 😁
Fx. I needed to add a toolbar, and basically what I had to do is to copy-paste considerable amount of playground code and patch it a bit with chatgpt so fx. clear formatting clears more things that it initially did. 😅
Thanks to everyone who works on lexical, you guys rock! 💪
Right now if you use the markdown plugin, even if you don't want to support "Code" blocks, you'll still endup with prismjs in your bundle.
Ideally this would be optional.
The text was updated successfully, but these errors were encountered: