Your code looks ok and would work in any other component other than colors, because colors need the higher-order-component withColors. In the past I struggled also dealing with the behaviour, that your are describing and found these two solutions:
-
If you want to insert your own color component, check the second example from here https://awhitepixel.com/blog/add-custom-settings-to-existing-wordpress-gutenberg-blocks/.
-
Otherwise you can just add color support in the blocks.registerBlockType. This is also what i’m using right now and is working great:
if( ['core/quote'].includes(name) ){ const supports = { ...props.supports, color: true, }; props = { ...props, supports }; }
Here is also a link https://css-tricks.com/a-crash-course-in-wordpress-block-filters/
Related Posts:
- Add pre-publish conditions to the block editor
- How does Gutenberg handle translations in React?
- How can I access core/paragraph textColor in a block template
- Saving post meta using the new EntityProvider APIs
- Implement Panel Color Inspector Control in Gutenberg
- gutenberg dynamic block is returning 404
- Gutenberg InspectorControls is deprecated, how to add custom block settings?
- How should you internationalize javascript spread in multiple files but build in one?
- Why is onChange={ ( content ) => setAttributes( { content } )} now used?
- How to set column widths in a CPT block template?
- Access GutenBerg data with Javascript?
- Only show focused toolbar for Gutenberg Block with Multiple text fields
- Gutenberg: How to Change Post Status Programmatically?
- Once Again: How to Remove Option from Gutenberg Editor for Specific Block in theme.json
- Uncaught TypeError: wp.apiFetch is not a function
- how to get a more significant error response from ServerSideRender
- Align a custom block button by wrapping it in div
- Using applyFormat (from @wordpress/rich-text) to make persistent changes to Gutenberg’s rich text value
- Block validation: Block validation failed for `my-block`
- How to set the localization for a Gutenberg block?
- How does the Gutenberg mobile/tablet/desktop preview work with media queries?
- How to render core component inside edit() within custom registered block in Gutenberg?
- Modify Core Block Default Attributes
- WordPress PluginSidebar, TextControl setting and saving the default value
- How can I dynamically wrap in a Gutenberg block?
- Modifying the Gutenberg Button Block
- Style Gutenberg metaboxes like they belong on the site
- How to get featured_media of a post with getEntityRecords?
- How to grab posts in Gutenberg Block?
- How can I access the attributes of a block within InnerBlocks?
- How to avoid duplicate dependencies in Gutenberg blocks
- How to update a Gutenberg block without manually recovering it?
- Gutenberg Dynamic Block not Storing Attributes
- Is it possible to access the wp-admin from one instance while keeping WP_HOME pointing to the balancing url?
- Show pasted link text with diacritics not encoded
- How to Add predefined CSS Classes to a Block using Gutenberg
- Updating a block’s edit / save without reinventing the wheel
- Custom dynamic Gutenberg block not rendering
- How to get an array of custom blocks by block name
- How do I addFilter to core/paragraph to add an attribute and see the change in the editor?
- How to register a embed handler as a fallback to a oEmbed handler?
- Performance of Gutenberg block attributes with source selectors vs without
- What version of React does Gutenberg use?
- Block background color not appearing on site
- For developers, what impact can we expect Gutenberg to have on the loop?
- Why is an argument of onChange nested in … in Gutenberg custom block RichText?
- Gutenberg: Heading with subheading/paragraph
- BlockControls not showing floating (show up in the top toolbar)
- Change label text in Gutenberg’s built in excerpt panel
- Style Gutenberg Editor based on Post Type or Page Template
- Gutenberg: How filter blocks of a certain type with parse_blocks recursively?
- Gutenberg add checkbox using PluginPostStatusInfo
- How to view all currently registered block patterns?
- How do I activate a certain block template only when editing the front page?
- LinkControl – how to toggle opensInNewTab
- Block editor — how to remove default classes
- Creating a custom slider block from InnerBlocks using React Slick
- Alter core block’s DOM – in both output AND editor
- ServerSideRender not rendering in block editor, but output is in “apiFetch”
- Can you disable typography panels for just the paragraph block?
- I cant find the custom html block
- Gutenberg allow use of block, but hide it from the block picker
- I am working with gutenberg blocks, specially a slider block. I wish to show the excerpt content from a custom api to the backend as well as frontend
- WordPress Gutemberg RichText FormatType no wrap with tagName
- Keyboard shortcut to format text as superscript or subscript
- How to add custom HTML tags in the visual mode via keyboard only?
- Add page title after first block
- Save JSON data with Gutenberg and show it in the content
- Gutenberg Blocks – Save a predefined text attribute?
- Adding a size to core/image in an innerblocks breaks the save
- How can I programmatically disable Gutenberg query block patterns?
- Is it possible to use the WordPress block directory to make my own custom blocks
- Gutenberg blocks – template_lock with several post type
- Gutenberg – reusable blocks that I can edit? Am I being slow?
- Block editor: Sandbox iframe shows outdated HTML
- Gutenberg Development vs Release version?
- Gutenberg Array push
- Gutenberg: Why doesn’t the button core-component render on the frontend
- block theme FSE – save changes to the theme?
- How can I avoid setTimeout and redundant getEntityRecord calls in a block editor sidebar?
- Can this react script be optimized? How to make it faster
- Enable varying text for Phone, Tablet and Desktop
- Debouncing Input value with block attributes
- Using the block theme in production
- When using the MediaPlaceholder component, will skipping blobUrl handling break something?
- Pass component name in onChange [closed]
- Add another option to default link control settings panel?
- With full-site-editing menus, how do I create a non-linking top-level menu item with linking sub-pages
- How can I render a built-in Gutenberg block with InnerBlocks outside of the block editor?
- How do I add filters in Twenty-Twenty-Three without a functions.php?
- Different style options for the same block depending where it is used
- How to extract ‘intro’ block from page content, but later strip from page main content
- Add a new option to Social Link block
- Editing Inline fonts/typeface using the block editor
- What is the proper way of using React Hooks in Gutenberg on frontend?
- How to add Gutenberg editor on frontend page?
- WordPress gutenberg block serverside rendering html elements not showing up
- Gutenberg: change block Components Popover properties
- Unable to register a block using block.json in Block Editor
- $attributes not defined in block.json PHP template for ACF blocks