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 Fix: get table-cell background selection color from a class #6658

Merged
merged 11 commits into from
Nov 25, 2024

Conversation

hamza221
Copy link
Contributor

@hamza221 hamza221 commented Sep 22, 2024

Description

Get table-cell background selection styles from a theme class tableCellSelected instead of directly updating the styles of the table cell nodes.

In order to upgrade to this version, you will need to add some CSS like this:

.PlaygroundEditorTheme__tableCellSelected {
  caret-color: transparent;
}
.PlaygroundEditorTheme__tableCellSelected::after {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  background-color: highlight;
  mix-blend-mode: multiply;
  content: '';
  pointer-events: none;
}

The following unused theme properties were removed:

  • tableCellEditing
  • tableCellPrimarySelected
  • tableCellSortedIndicator
  • tableResizeRuler

Closes #6655

After

table-selection-css.mov

Test plan

Existing tests were modified to no longer expect the styles to be added.

Copy link

vercel bot commented Sep 22, 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 Nov 24, 2024 8:38pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 24, 2024 8:38pm

@facebook-github-bot
Copy link
Contributor

Hi @hamza221!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

Copy link

github-actions bot commented Sep 22, 2024

size-limit report 📦

Path Size
lexical - cjs 30.91 KB (0%)
lexical - esm 30.79 KB (0%)
@lexical/rich-text - cjs 39.62 KB (0%)
@lexical/rich-text - esm 32.65 KB (0%)
@lexical/plain-text - cjs 38.21 KB (0%)
@lexical/plain-text - esm 29.93 KB (0%)
@lexical/react - cjs 41.34 KB (0%)
@lexical/react - esm 34 KB (0%)

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@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 22, 2024
@hamza221
Copy link
Contributor Author

hamza221 commented Sep 24, 2024

  • I left the old logic in, because I'm not sure about another way to set a default value (new to the code base)
  • I'll update the failing tests once the logic gets approved

@ivailop7
Copy link
Collaborator

The CSS class is probably a leftover from the experimental table, which we deleted a year/year and a half ago. I think it's fine to reuse that CSS class, I did the same with reintroducing the hover add column/row buttons and reusing the existing CSS classes. I'm not in favour of adding an extra override CSS class, as long as you pick the CSS class name from the config.theme object use the existing CSS Class, also +1 for the test.

@etrepum
Copy link
Collaborator

etrepum commented Sep 24, 2024

I agree that an override class is not necessary. Should be up to the user to make sure their configuration of classes and styles composes correctly.

@matveeva-as
Copy link

Would be great to see this fix in the next release!

@ivailop7
Copy link
Collaborator

@hamza221 are you interested in finishing this one?

@hamza221
Copy link
Contributor Author

I'll send a commit tomorrow

@hamza221
Copy link
Contributor Author

Thank you @etrepum

@etrepum etrepum self-assigned this Nov 11, 2024
@etrepum
Copy link
Collaborator

etrepum commented Nov 25, 2024

@ivailop7 might want to take a look at this one

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 etrepum added this pull request to the merge queue Nov 25, 2024
Merged via the queue into facebook:main with commit 89af994 Nov 25, 2024
37 checks passed
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.

Feature: Support Custom Color for Table Selection Highlight
5 participants