/** * WordPress dependencies */ const { __ } = wp.i18n; const { Component, Fragment, } = wp.element; const { PanelBody, SelectControl, Placeholder, } = wp.components; const { InspectorControls, } = wp.blockEditor; const { sidebars, } = window.canvasWidgetizedBlock; /** * Component */ export default class WidgetizedAreaBlockEdit extends Component { constructor() { super( ...arguments ); } render() { const { attributes, setAttributes, } = this.props; const { area, } = attributes; const options = [ { label: __( 'Select Widgetized Area' ), value: '', }, ]; if ( sidebars && Object.keys( sidebars ).length ) { Object.keys( sidebars ).forEach( ( name ) => { options.push( { label: sidebars[ name ].name, value: sidebars[ name ].id, } ); } ); } return ( { setAttributes( { area: val } ) } } /> { setAttributes( { area: val } ) } } /> ); } }