I'm attempting to use the HOCs withInstanceId
(to generate a unique identifier to use as an ID in the HTML) and withColors
(to use a color picker in the sidebar) in Gutenberg and I'm unsure of the correct ESNext syntax. (And I suppose technically the correct non ESNext syntax...)
This is my starting point, but it's clearly not correct:
const { __ } = wp.i18n;
const { registerBlockType } = wp.blocks;
const { withColors } = wp.editor;
const { withInstanceId } = wp.compose;
registerBlockType( 'blocksetc/test', {
title: __( 'title' ),
attributes: {
highlightColor: {
type: "string"
},
},
edit: withColors( 'highlightColor' )( function ({ attributes, setAttributes, className, instanceId }) {
return (
);
},
save( { attributes } ) {
return (
);
},
} );
A little guidance would be appreciated.