Search code examples
wordpresswordpress-gutenberg

How to add Richtext toolbar editing in custom wordpress plugin


I want to use the wordpress own text formatting used in gutenberg text blocks to format a text field in the backend of a custom plugin. However I don't want to integrate the whole block concept in the plugin. I just want to format text in a textfield (or a div) using the editor toolbar from gutenberg.

I was searching for the right point to hook in. THe "Formatting API" sounded good, but there I can just add button to the toolbar. But I didn't found a hint how to add the toolbar somwhere on the page outside a block.


Solution

  • The tutorial Building a custom block editor from the Documentation walks through the process of creating a custom instance of the Block Editor. The concepts & code demonstrated could be used in your plugin to use/access the Formatting API and create a modern, block-based UI for your plugin settings.