Make possible to overwrite the globally defined colors in PanelColorSettings#10457
Conversation
|
Love love love it! Thanks @jorgefilipecosta! |
1e8731f to
42b4476
Compare
talldan
left a comment
There was a problem hiding this comment.
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.
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.
| import withColorContext from '../color-palette/with-color-context'; | ||
| import { getColorObjectByColorValue } from '../colors'; | ||
|
|
||
| const customColorsDisableForSetting = ( disableCustomColors, colorSetting ) => { |
There was a problem hiding this comment.
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.