Describe the bug
I have a usecase where we need to update the Gutenberg global color palette after the page has loaded using javascript. I am aware of the add_theme_support('editor-color-palette', ...) PHP option but that will not work in this case.
To reproduce
Call the following:
wp.data.dispatch( 'core/editor' ).updateEditorSettings( {colors: [{name: 'test', slug: 'test', color: '#00FF00'}]} );
This works to update the editor settings, which can be confirmed using:
wp.data.select( "core/editor" ).getEditorSettings()
However nothing changes in the UI to reflect the new settings.
Expected behavior
UI updates with new settings applied.
Additional context
Wordpress v5.2.1 and Gutenberg plugin v5.8.0.
Stack overflow issue: https://stackoverflow.com/questions/56438265/updating-gutenberg-global-color-palette-in-javascript
Describe the bug
I have a usecase where we need to update the Gutenberg global color palette after the page has loaded using javascript. I am aware of the
add_theme_support('editor-color-palette', ...)PHP option but that will not work in this case.To reproduce
Call the following:
This works to update the editor settings, which can be confirmed using:
However nothing changes in the UI to reflect the new settings.
Expected behavior
UI updates with new settings applied.
Additional context
Wordpress v5.2.1 and Gutenberg plugin v5.8.0.
Stack overflow issue: https://stackoverflow.com/questions/56438265/updating-gutenberg-global-color-palette-in-javascript