Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PR 3] Removed edge-cases of GridSelection #5291

Conversation

icrosil
Copy link
Contributor

@icrosil icrosil commented Nov 27, 2023

Why

In #5276 we proposed a solution on how to migrate GridSelection out of the core of the bundle, here is the third step by removing edge-case usage of GridSelection to decrease dependencies.

What

  • insertGeneratedNodes - function that inserts into table nodes from another tables - refactored to use only core functions, without any knowledge of the gridSelection
  • mergeNodeStrategy - related to funciton above, now uses RangeSelection to select newly added nodes.
  • patchStyleText - can handle current logic without knowledge of GridSelection

icrosil added 13 commits November 23, 2023 17:25
…-baseselection' into 5276-feature-gridselection-separation-from-lexical-core-gridselection-vs-nodeselection
…-baseselection' into 5276-feature-gridselection-separation-from-lexical-core-gridselection-vs-nodeselection
…-baseselection' into 5276-feature-gridselection-separation-from-lexical-core-gridselection-vs-nodeselection
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 27, 2023
Copy link

vercel bot commented Nov 27, 2023

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 Dec 8, 2023 4:18pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 8, 2023 4:18pm

icrosil added 2 commits December 1, 2023 16:35
…-baseselection' into 5276-feature-gridselection-separation-from-lexical-core-gridselection-vs-nodeselection
icrosil added 6 commits December 1, 2023 17:01
…-gridselection-vs-nodeselection' into 5276-feature-gridselection-separation-from-lexical-core-remove-grid-seleciton
…-baseselection' into 5276-feature-gridselection-separation-from-lexical-core-gridselection-vs-nodeselection
…-gridselection-vs-nodeselection' into 5276-feature-gridselection-separation-from-lexical-core-remove-grid-seleciton
Base automatically changed from 5276-feature-gridselection-separation-from-lexical-core-gridselection-vs-nodeselection to main December 5, 2023 10:24
Copy link

github-actions bot commented Dec 5, 2023

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
packages/lexical/dist/Lexical.js 26.58 KB (-0.03% 🔽) 532 ms (-0.03% 🔽) 36 ms (-10.27% 🔽) 567 ms
packages/lexical-rich-text/dist/LexicalRichText.js 40.54 KB (-0.04% 🔽) 811 ms (-0.04% 🔽) 120 ms (+36.87% 🔺) 931 ms
packages/lexical-plain-text/dist/LexicalPlainText.js 40.51 KB (-0.04% 🔽) 811 ms (-0.04% 🔽) 74 ms (-31.9% 🔽) 884 ms

@icrosil
Copy link
Contributor Author

icrosil commented Dec 7, 2023

Hey @zurfyx , @fantactuka could you please help me review this PR?

Comment on lines 342 to 345
const rangeSelection = $createRangeSelection();
rangeSelection.anchor.set(newAnchorCellKey, 0, 'element');
rangeSelection.focus.set(newFocusCellKey, 0, 'element');
$setSelection(rangeSelection);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a tricky one, I remember that a selection like this can break the table because you're essentially selecting the cells so operations like delete can make it inconsistent. I think that this entire function should be moved to the tables plugin and we can have a command to delegate handling this logic there.

We don't necessarily have to do it in this PR so you can leave GridSelection for now.

@icrosil icrosil merged commit dcff8ae into main Dec 8, 2023
43 of 45 checks passed
@icrosil icrosil deleted the 5276-feature-gridselection-separation-from-lexical-core-remove-grid-seleciton branch December 8, 2023 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: GridSelection separation from lexical core
3 participants