-
Notifications
You must be signed in to change notification settings - Fork 499
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
fix: text color detection bug fixed #1565
base: main
Are you sure you want to change the base?
Conversation
const color = Color.from(colorValue); | ||
|
||
// Only consider it empty if it has zero alpha or exactly equals transparent | ||
// Don't consider black (#000000) or other valid colors as empty |
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.
...selectedEl.styles?.defined, | ||
}; | ||
// Debug log to check what styles are coming from the DOM | ||
console.log('Selected element:', selectedEl.tagName); |
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.
We shouldn't ship logs in production
@@ -1,7 +1,7 @@ | |||
# Only add these if you have valid keys. Otherwise, comment them out. | |||
VITE_SUPABASE_API_URL= | |||
VITE_SUPABASE_ANON_KEY= | |||
VITE_MIXPANEL_TOKEN= | |||
# VITE_MIXPANEL_TOKEN= |
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 would not comment out the example here
Description
When selecting text elements in the editor (particularly headings), the properties panel was displaying text color as #000000 (black) even when the actual text had a different color (like red). This created a disconnect between what users saw in the editor and what was shown in the color properties panel.
My Approach:
Modified the
ColorInput
component to better handle text elements(p, h1-h6, span, div)
by prioritizing the computed color values directly from the DOM, ensuring that both inherited and applied colors are displayed correctly.Refined the
isColorEmpty
utility function to more accurately determine when a color is truly empty, preventing valid color values (such as black) from being incorrectly treated as empty.Related Issues
closes #1528
Type of Change
Screenshots (if applicable)
https://drive.google.com/file/d/1e8t2h5EoVcqeLmFiZyMKZ_ft6KkSCEBH/view?usp=drive_link
Additional Notes