• I’d like to be able to limit the format options for a custom block using an InnerBlock similar to what we can do for RichText. Is it possible to pass allowedFormats as a property to InnerBlocks using the block template API?

    Otherwise, is it possible to use wp.richText.unregisterFormatType( 'core/image' ) for just our custom block but still have these formats available for other blocks?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Aaron Robertshaw

    (@aaronrobertshaw)

    Hi @awetz583 ??

    If I’m following what you are aiming for, I’d expect the edit function for the custom block to define the allowed formats on the RichText component as done in this example.

    Is the issue that the supported inner blocks, for your custom block, are core blocks?

    If so, the only idea I can think of would be to explore using the editor.BlockEdit filter which would allow some customization of a block’s edit component. You might be able to conditionally alter the block’s edit component to control allowed formats.

    Otherwise, is it possible to use?wp.richText.unregisterFormatType( 'core/image' )?for just our custom block but still have these formats available for other blocks?

    From the docs, that does appear to be an all-or-nothing approach to disabling format types.

    Thread Starter Andrea Roenning

    (@awetz583)

    Thanks for the response. I experimented a bit with editor.BlockEdit and could not find a solution. I think this Github ticket is similar to what we hope to do: Block Editor: Provide a way to customize items in Block Toolbar?#47641 – I will add a comment there.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.