Comments (1)
Thanks for bringing this up! 👍
I see two problems here:
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
.
And here's the attempt to extract prismjs stuff outside CodeNode and add a function to dynamically inject it back in the userland if needed.
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! 💪
from lexical.
Related Issues (20)
- Chore: Update vite, rollup, and associated build-related packages
- Bug: $getSelection always returns null. HOT 1
- Bug: CSS property `scroll-padding` not working HOT 1
- Feature: Dev experience for createCommand HOT 1
- Bug: Google Docs checklist does not paste correctly
- Feature: Option to include blank lines in markdown
- Bug: Styles of pre-populated text in editorState is not applied + Error while upgrading to version 0.14.3 or higher HOT 4
- removeFromParent doesn't readjust selection
- Feature: Speed up tests with more caching
- Feature: LexicalComposer initialState should accept SerializedEditorState HOT 1
- Bug: Cannot toggle editor isEditable using react + react-dom v19 beta HOT 19
- Feature: React 19 testing and documentation
- Bug: Deleting a line (via `CMD` + `BACKSPACE`) when the range selection is at a decorator node does not work
- Feature: Switch from deprecated keyCode to key in internal onKeyDown handler
- Text formatting of token text nodes
- Bug: Selecting a line containing decorator node in the beginning and pressing `→` arrow key moves selection to the decorator node
- Feature: Support YJS Subdocs with Collaboration HOT 1
- [RFC] Plugins, normalizers, and nodes HOT 10
- Feature: picker active state on devtool UI HOT 3
- Feature: [lexical-website] Upgrade docusaurus-plugin-typedoc and typedoc-plugin-markdown HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lexical.