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] Bug: Table formatting and styling not persisting for empty cells #6626

Merged
merged 6 commits into from
Sep 13, 2024

Conversation

KatsiarynaDzibrova
Copy link
Contributor

@KatsiarynaDzibrova KatsiarynaDzibrova commented Sep 12, 2024

Description

Apply format change to empty paragraphs. Before it was only applied to text nodes

Closes #6583

Test plan

Before

Formatting is not applied to empty paragraphs
table-bug-before

After

Formatting is applied to empty paragraphs
table-bug-after

Copy link

vercel bot commented Sep 12, 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 13, 2024 3:34pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 13, 2024 3:34pm

@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 Sep 12, 2024
Copy link

github-actions bot commented Sep 12, 2024

size-limit report 📦

Path Size
lexical - cjs 29.77 KB (0%)
lexical - esm 29.6 KB (0%)
@lexical/rich-text - cjs 38.24 KB (0%)
@lexical/rich-text - esm 31.46 KB (0%)
@lexical/plain-text - cjs 36.82 KB (0%)
@lexical/plain-text - esm 28.86 KB (0%)
@lexical/react - cjs 40.01 KB (0%)
@lexical/react - esm 32.93 KB (0%)

ivailop7
ivailop7 previously approved these changes Sep 12, 2024
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.

LGTM, @etrepum for a second pair of eyes

@ivailop7 ivailop7 added the extended-tests Run extended e2e tests on a PR label Sep 12, 2024
Comment on lines 1194 to 1199
selectedNodes.forEach((node) => {
if ($isParagraphNode(node)) {
const newFormat = node.getFormatFlags(formatType, null);
node.setTextFormat(newFormat);
}
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should implement alignment with the first cell of the selection. When the text/paragraphs have mixed formatting toggling bold should change the entire selection to have the same setting for bold.

Screen.Recording.2024-09-12.at.11.49.27.mov

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 25e38b6 and c995bf3

@@ -357,7 +357,7 @@ export class TableObserver {
const focus = formatSelection.focus;

selection.getNodes().forEach((cellNode) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is where we would have to capture the format alignment

Aligns format between different cells of the table for tableSelection. Get the format for the first cell and pass it to formatText function to allign all the next cells with it.
etrepum
etrepum previously approved these changes Sep 13, 2024
Copy link
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

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

Looks great, thank you!

packages/lexical-table/src/LexicalTableObserver.ts Outdated Show resolved Hide resolved
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