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

Updated cell calculation based on cellspans #5141

Merged
merged 1 commit into from
Oct 18, 2023
Merged

Conversation

icrosil
Copy link
Contributor

@icrosil icrosil commented Oct 18, 2023

Why

Based on this issue with Tables current algorithm for resizing is out of shape for cases where cells are merged. What happens is it tries to map index from given active cell and make sure that it exists on each row, if not - throwing exception.

#4415

What changed

I've updated TableCellResizer to acomodate that - now it claculates length of row based on children and their cell span. From this we are finding which column corresponds to given active cell, that now always should be less or equal to active cell. After this we are using this column to set width.

Test:

lexical1.mov

E2E test - couldn't find a way to resize in unit/e2e test.

@icrosil icrosil added the tables Relates to Lexical Tables label Oct 18, 2023
@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 Oct 18, 2023
@vercel
Copy link

vercel bot commented Oct 18, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview Oct 18, 2023 4:08pm
lexical-playground ✅ Ready (Inspect) Visit Preview Oct 18, 2023 4:08pm

@github-actions
Copy link

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
packages/lexical/dist/Lexical.js 28.31 KB (0%) 567 ms (0%) 497 ms (+125.77% 🔺) 1.1 s
packages/lexical-rich-text/dist/LexicalRichText.js 39.62 KB (0%) 793 ms (0%) 323 ms (-30.52% 🔽) 1.2 s
packages/lexical-plain-text/dist/LexicalPlainText.js 39.6 KB (0%) 792 ms (0%) 726 ms (+36.48% 🔺) 1.6 s

Copy link
Collaborator

@ivailop7 ivailop7 left a comment

Choose a reason for hiding this comment

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

Thank you for this fantastic fix!

@ivailop7 ivailop7 merged commit dfa24df into main Oct 18, 2023
@icrosil icrosil deleted the table_resize_crash branch October 19, 2023 09:10
@icrosil icrosil restored the table_resize_crash branch October 19, 2023 14:09
@icrosil icrosil deleted the table_resize_crash branch October 20, 2023 11:12
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. tables Relates to Lexical Tables
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants