Allow / Disallow Gutenberg Toolbar Options
When coding a Gutenberg block plugin for WordPress and you want to remove some of the <RichText> toolbar options on that block. You can set “withoutInteractiveFormatting” and then list the allowedFormats.
<RichText
withoutInteractiveFormatting
allowedFormats={ [ 'core/bold', 'core/italic', 'core/textColor','core/strikethrough' ] }
value={ html }
/>
All Allowed Formats
- core/bold (Bold Text)
- core/code (Code Formating)
- core/image (Inline Image)
- core/italic (Italic Text)
- core/link (Link Option)
- core/strikethrough (Strikethrough Text)
- core/underline (Underline Text)
- core/textColor (Highlight)
- core/subscript (sub characters e.g. 2)
- core/superscript, (super characters e.g. 2nd)
- core/keyboard, (keyboard)
- core/unknown, (Clear Unknown Formating)
- core/language, (Language Options)