Coder Social home page Coder Social logo

Comments (1)

non25 avatar non25 commented on May 21, 2024 6

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.