/**
 * Gutenberg sidebar WYSIWYG — TinyMCE so text color stays in this field's toolbar
 * (RichText core/text-color popovers mis-anchor to the canvas block toolbar).
 */
import { createElement } from '@wordpress/element';
import WysiwygField from '../../admin/components/WysiwygField';

/**
 * @param {object}   props
 * @param {object}   props.field
 * @param {string}   props.value
 * @param {Function} props.onChange
 */
export default function GutenbergWysiwygField( { field, value = '', onChange } ) {
	return createElement(
		'div',
		{ className: 'bm-gutenberg-wysiwyg' },
		createElement( WysiwygField, {
			label: field.label,
			value: value || '',
			onChange,
			allowedCommand:
				field.allowedCommand ?? field.allowedCommands ?? null,
		} )
	);
}
