-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
base: main
Are you sure you want to change the base?
Conversation
…m a class Signed-off-by: hamza221 <[email protected]>
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Hi @hamza221! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
size-limit report 📦
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
packages/lexical-playground/src/themes/PlaygroundEditorTheme.css
Outdated
Show resolved
Hide resolved
…lor from a class Signed-off-by: Hamza Mahjoubi <[email protected]>
|
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. |
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. |
Would be great to see this fix in the next release! |
@hamza221 are you interested in finishing this one? |
I'll send a commit tomorrow |
…lor from a class Signed-off-by: Hamza Mahjoubi <[email protected]>
🤞 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is getting very close! I believe there's one mistake in the test changes, and that it can be simplified further by not using element.style at all
colspan="2" | ||
style="background-color: rgb(172, 206, 247); caret-color: transparent"> | ||
class="PlaygroundEditorTheme__tableCell PlaygroundEditorTheme__tableCellHeader PlaygroundEditorTheme__tableCellSelected" | ||
rowspan="2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changing from colspan to rowspan seems suspicious?
rowspan="2" | |
colspan="2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was an accidental ctrl c +ctrl v 😥 I'll revert it
@@ -1089,7 +1090,7 @@ export function $updateDOMForSelection( | |||
|
|||
if (selectedCellNodes.has(lexicalNode)) { | |||
cell.highlighted = true; | |||
$addHighlightToDOM(editor, cell); | |||
$addHighlightToDOM(editor, cell, editor._config.theme); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this signature should change when the editor is an argument to this function already, would be easier to reference editor._config.theme
from inside $addHighlightToDOM
function $addHighlightToDOM( | ||
editor: LexicalEditor, | ||
cell: TableDOMCell, | ||
editorThemeClasses: EditorThemeClasses, | ||
): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function $addHighlightToDOM( | |
editor: LexicalEditor, | |
cell: TableDOMCell, | |
editorThemeClasses: EditorThemeClasses, | |
): void { | |
function $addHighlightToDOM(editor: LexicalEditor, cell: TableDOMCell): void { | |
const editorThemeClasses = editor._config.theme; |
element.style.setProperty('background-color', `rgb(${BROWSER_BLUE_RGB})`); | ||
} | ||
element.style.setProperty('caret-color', 'transparent'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's any reason to use style directly if we are applying classes correctly
Were you planning to finish this PR? |
I'm okay with someone else taking over, I'm Afk until 2025 |
I'll take a look at finishing this after #6759 |
Thank you @etrepum |
Description
get table-cell background selection color from a class
I couldn't find where
tableCellSelected
is used, my guess is that it's not so I overwrote the classand I don't think that
tableCellSelectedOverwrite
is a good name so I'm open for other suggestion it's there as a placeholder for now.Closes #6655
Test plan