-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Make possible to overwrite the globally defined colors in PanelColorSettings #10457
Make possible to overwrite the globally defined colors in PanelColorSettings #10457
Conversation
Love love love it! Thanks @jorgefilipecosta! |
1e8731f
to
42b4476
Compare
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.
Thanks for pointing this out, Jorge! 😄 Looks like some really helpful changes.
`; | ||
|
||
exports[`PanelColorSettings should render a color panel if at least one setting specifies some colors to choose 1`] = ` | ||
<Component |
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 noticed that the component used in the test is wrapped with ifCondition
, which caused the shallow render to not render the children of PanelColorSettings (making the tests a bit obsolete). I found that you can use wrapper.dive() in enzyme to render the children, so I've pushed a commit with some additional snapshots.
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.
Thank you!
@@ -17,58 +17,107 @@ import ColorPaletteControl from '../color-palette/control'; | |||
import withColorContext from '../color-palette/with-color-context'; | |||
import { getColorObjectByColorValue } from '../colors'; | |||
|
|||
const customColorsDisableForSetting = ( disableCustomColors, colorSetting ) => { |
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.
nitpick: the name of this function could start with 'has' like the other two functions, and should probably use the adjective 'disabled' instead of the verb 'disable'.
…ed colors settings (colors arrays and disableCustomColors) in PanelColorSettings. The overwrite can be global for all the color panels of the component or local per each settings panel.
6719168
to
80184f8
Compare
I'll update my deprecation PR for the correct version numbers. |
This PR makes it possible to overwrite the globally defined colors (colors arrays and disableCustomColors) in PanelColorSettings.
The overwrite can be global for all the color panels of the component or local per each settings panel.
This PR makes sure that we offer all the functionality that the combination of wp.editor.PanelColor and wp.components.PanelColor had. Making it possible to deprecate these components and unify the color UI components. Deprecation PR created by @chrisvanpatten is available in #10391.
How has this been tested?
I checked that the blocks using colors (button, paragraph, pull quote still work as before).
I tried a theme that sets the colors or disables custom colors, and everything worked as before.
I created the test block available in https://gist.github.com/jorgefilipecosta/ac1d68e492869465b054868baac60df2 and checked that the definition overwrites specified were correctly applied.