lexical
lexical copied to clipboard
fix mutate with replace klass
When registering mutation check for Node that replaced original one. mutation are a map so only one entry.
Should fix #4498
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| lexical | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | May 24, 2024 8:52am |
| lexical-playground | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | May 24, 2024 8:52am |
Hi @Piechota!
Thank you for your pull request and welcome to our community.
Action Required
In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.
Process
In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.
Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.
If you have received this in error or have any questions, please contact us at [email protected]. Thanks!
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!
This looks like it solves the same problem as #6076 so it should close that as well if this PR is chosen. My review comments would be basically the same: https://github.com/facebook/lexical/pull/6076#pullrequestreview-2051214716
I think this approach is probably better, but without really any docs or test coverage it's hard to say if there are any additional caveats to this simpler solution
In that other PR you have a good point about chain of node replacements. Currently this code doesn't support it, I will fix it when I have a second.
So I have added loop to support multilevel replacement. But I have problem testing it, it seems like right now it isn't supported really well.
Basically if node A replaces node B, and node C replaces node B. Creating node A doesn't create node C. I think we should also loop over replace in $applyNodeReplacement() But that's for different change.
Good idea, it seems that there is a lack of test coverage all around for this corner of the API!
If no-one picks this up - I'll look at it later to add some tests. I touched klasses already in the devtools
If no-one picks this up - I'll look at it later to add some tests. I touched klasses already in the devtools
That would be very welcome! I'll close https://github.com/facebook/lexical/pull/6076 since this one seems more in line with expectations.
size-limit report 📦
| Path | Size | Loading time (3g) | Running time (snapdragon) | Total time |
|---|---|---|---|---|
| packages/lexical/dist/Lexical.js | 23.93 KB (0%) | 479 ms (0%) | 289 ms (-2.43% 🔽) | 767 ms |
| packages/lexical-rich-text/dist/LexicalRichText.js | 34.59 KB (0%) | 692 ms (0%) | 840 ms (-17.75% 🔽) | 1.6 s |
| packages/lexical-plain-text/dist/LexicalPlainText.js | 34.59 KB (0%) | 692 ms (0%) | 970 ms (-8.52% 🔽) | 1.7 s |
Closed in favor of https://github.com/facebook/lexical/pull/6189 (tests added)