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

[lexical-table] Fix table cell format for selection within cell #6582

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ivailop7
Copy link
Collaborator

@ivailop7 ivailop7 commented Aug 31, 2024

Currently, the TableCellNode tracks the format of the paragraph inside. This is applied correctly when selection is via table selection (range selection including a table, whole table selection, cells selection).

There is a collection of cases if it's selection within the table cell, since the table cell is not selected the format doesn't propagate to the parent TableCellNode correctly and things get out of sync. This fixes those cases.

Before:

before.mov

After:

Things are in sync

after.mov

Copy link

vercel bot commented Aug 31, 2024

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 Sep 7, 2024 6:40pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 7, 2024 6:40pm

@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 Aug 31, 2024
@ivailop7 ivailop7 changed the title Fix table cell format for selection within cell [lexical-table] Fix table cell format for selection within cell Aug 31, 2024
Copy link

github-actions bot commented Aug 31, 2024

size-limit report 📦

Path Size
lexical - cjs 29.66 KB (0%)
lexical - esm 29.48 KB (0%)
@lexical/rich-text - cjs 38.07 KB (0%)
@lexical/rich-text - esm 31.32 KB (0%)
@lexical/plain-text - cjs 36.65 KB (0%)
@lexical/plain-text - esm 28.66 KB (0%)
@lexical/react - cjs 39.83 KB (0%)
@lexical/react - esm 32.75 KB (0%)

@ivailop7 ivailop7 added the extended-tests Run extended e2e tests on a PR label Aug 31, 2024
@moughxyz
Copy link
Contributor

moughxyz commented Sep 2, 2024

Hi @ivailop7, I know it's not my place to say. But given you are able to reproduce and demonstrate this issue in the playground, it should also be possible to write an e2e test for this. Given there are many organizations that rely on this codebase, would you be willing to write one, or otherwise specify in your PR description why tests were not included for this change?

@etrepum
Copy link
Collaborator

etrepum commented Sep 3, 2024

This kinda seems like something that should be handled by the selection class rather than a command? Since we do have a paragraph in every cell maybe it makes sense not to store this format there at all since it can and should already be stored on the paragraph (per #6583)

@ivailop7
Copy link
Collaborator Author

ivailop7 commented Sep 8, 2024

This kinda seems like something that should be handled by the selection class rather than a command? Since we do have a paragraph in every cell maybe it makes sense not to store this format there at all since it can and should already be stored on the paragraph (per #6583)

Yeah, that's probably a better approach and would make preserving the styling on empty cells more consistent. Need to redo it, but my holidays ended, so don't have as much time to do PRs. Will revisit in the coming weeks.

@ivailop7 ivailop7 marked this pull request as draft September 9, 2024 08:53
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. extended-tests Run extended e2e tests on a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants