Hello I need to add a button to the toolbar gutenberg I found this / but I do not get what is wrong for the button to appear
functions.php
my-custom-format.js
( function( wp ) {
var MyCustomButton = function( props ) {
return wp.element.createElement(
wp.editor.RichTextToolbarButton, {
icon: 'editor-code',
title: 'Sample output',
onClick: function() {
console.log( 'toggle format' );
},
}
);
}
wp.richText.registerFormatType(
'my-custom-format/sample-output', {
title: 'Sample output',
tagName: 'samp',
className: null,
edit: MyCustomButton,
}
);
} )( window.wp );