import { __ } from "@wordpress/i18n"; import { registerFormatType, toggleFormat } from "@wordpress/rich-text"; import { RichTextToolbarButton } from "@wordpress/block-editor"; const FORMAT_NAME = "betterdocs/highlight"; const highlightIcon = ( ); const Edit = ({ isActive, value, onChange }) => ( onChange(toggleFormat(value, { type: FORMAT_NAME }))} isActive={isActive} /> ); registerFormatType(FORMAT_NAME, { title: __("Highlight", "betterdocs"), tagName: "span", className: "highlight", edit: Edit, });