![]() ![]() For example to disable inline images, use: wp.richText.unregisterFormatType( 'core/image' ) If you just want to disable a format from the editor, you can use the unregisterFormatType function. The RichText component uses formats to display inline elements, for example images within the paragraph block. Top ↑ Disable Specific Format Types in Editor If you want to limit the formats allowed, you can specify using allowedFormats property in your code, see the example above or the component documentation for details. If you’d still like to use RichText, you can eliminate all of the formatting options by specifying the withoutInteractiveFormatting property. Would it be better to use a basic input or textarea element? If you don’t think any formatting should be possible, these HTML tags may make more sense. Top ↑ Unwanted Formatting Options Still Displayīefore moving forward, consider if using the RichText component makes sense at all. Search: RichText is used in two places, for both the label above the search field and the submit button text.Quote: RichText is used in two places, for both the quotation and citation text.Heading: RichText is used to enter the heading’s text.Button: RichText is used to enter the button’s text. ![]() The JavaScript edit function linked below for each block can be used as a best practice reference while creating your own blocks. There are a number of core blocks using the RichText component. Top ↑ Core Blocks Using the RichText Component Property Referenceįor a list of the possible properties to pass your RichText component, check out the component documentation on GitHub. Unlike other components that exist in the Component Reference section, RichText lives separately because it only makes sense within the block editor, and not within other areas of WordPress. For example, you can dictate whether to allow the user to make text bold, italics or both.
0 Comments
Leave a Reply. |