Skip to content

Add the ability to scope RichTextFormats to specific blocks / tagNames #46551

Closed

Description

@fabiankaegy

Currently, when a rich text format gets registered it shows up for every block / rich text area available.

Individual RichText components can specify a manual allowedFormats list or specify that there shouldn't be any interactive formats applied to the element withoutInteractiveFormatting.

But this cannot get modified on the Format level. So it for example is not possible to remove a specific format option from the caption element. Or the heading block.

Possible Solutions

It would be great to be able to configure at the Fomat level which blocks / which tag names the format should show up for and or which it should not show up for. So an allow / deny list for the supported blocks / tagNames

Activity

  1. fabiankaegy commented on Apr 21, 2024

    @fabiankaegy
    MemberAuthor

    Actually as @2ndkauboy pointed out to me on Twitter limiting a rich text format to only a certain type of block is already possible and even documented in the getting started guide here: https://developer.wordpress.org/block-editor/how-to-guides/format-api/#step-4-show-the-button-only-for-specific-blocks-optional

    Closing this issue 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions