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 1] Swap instance selection for BaseSelection in most cases #5280

Conversation

icrosil
Copy link
Contributor

@icrosil icrosil commented Nov 23, 2023

Why

In #5276 we proposed a solution on how to migrate GridSelection out of the core of the bundle, here is the first step by removing type usage to the BaseSelection where all type of selections could be added

What

  • Updated | GridSelection | RangeSelection | NodeSelection for BaseSelection
  • Added 3 methods to BaseSelection interface - insertNodes, getCachedNodes, setCachedNodes that probably should be private but have no preference personally.
  • Update TS and Flow files
  • Updated tests from $getSelection to $getRangeSelection where logically we expect Range selection

@icrosil icrosil linked an issue Nov 23, 2023 that may be closed by this pull request
@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 23, 2023
Copy link

vercel bot commented Nov 23, 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 1, 2023 5:44pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 1, 2023 5:44pm

Copy link

github-actions bot commented Nov 23, 2023

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
packages/lexical/dist/Lexical.js 27.93 KB (+0.12% 🔺) 559 ms (+0.12% 🔺) 180 ms (-67.68% 🔽) 738 ms
packages/lexical-rich-text/dist/LexicalRichText.js 40.18 KB (+0.09% 🔺) 804 ms (+0.09% 🔺) 355 ms (+35.62% 🔺) 1.2 s
packages/lexical-plain-text/dist/LexicalPlainText.js 40.15 KB (+0.09% 🔺) 804 ms (+0.09% 🔺) 251 ms (-25.42% 🔽) 1.1 s

Copy link
Contributor

@fantactuka fantactuka left a comment

Choose a reason for hiding this comment

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

Nice one 👍

selection.add(key);
} else {
selection.delete(key);
if ($isNodeSelection(selection)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It should already be node selection at this point, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, although flow was still complaining at this point.

@icrosil icrosil changed the title Swap instance selection for BaseSelection in most cases [PR 1] Swap instance selection for BaseSelection in most cases Nov 27, 2023
Copy link
Member

@zurfyx zurfyx left a comment

Choose a reason for hiding this comment

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

Great work, added some nit comments but I love what I'm seeing here! Thanks for taking the lead on this on this major refactor

@zurfyx zurfyx merged commit 2afcbbe into main Dec 1, 2023
45 checks passed
@zurfyx zurfyx deleted the 5276-feature-gridselection-separation-from-lexical-core-baseselection branch December 1, 2023 19:21
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
4 participants