-
Hi! I’ve successfully built a custom format type that I based off of this tutorial. This is working great. However, my custom format doesn’t appear for the core button block. Is there any way for me to apply the custom format to buttons as well? From what I've understood any custom formats should be applied by default to all blocks that are using the RichText component, which the button block is doing. However, the button block has the prop withoutInteractiveFormatting set for the RichText component within, which I believe is the cause of my problem. This can be seen in the source here. Is there any way for me to get my custom format to appear for the button block without having to build my own custom button block? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hi @Branch, maybe not the ideal way for solving this, but try to wrap your Example: <Fill name="RichText.ToolbarControls.italic">
<ToolbarButton>
...
</ToolbarButton>
</Fill> This will render your custom format Type next to the italic format type and not anymore in the more options menu. You should then also specify an icon in the ToolbarButton component via prop. Hope this is gonna help 😄 |
Beta Was this translation helpful? Give feedback.
Hi @Branch , I have checked the filter mechanism of the prop you've mentioned. Does your custom format type includes one of these tags?
gutenberg/packages/block-editor/src/components/rich-text/use-format-types.js
Lines 17 to 29 in 99c3dda
if yes, they will be filtered:
gutenberg/packages/block-editor/src/components/rich-text/use-format-types.js
Lines 74 to 79 in 99c3dda