import { InspectorControls, useBlockProps } from '@wordpress/block-editor'; import { ToggleControl, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import type { BlockEditProps } from '@wordpress/blocks'; import { useToolsPanelDropdownMenuProps } from '../utils/hooks'; import useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes'; import type { CommentEditLinkAttributes } from './types'; export default function Edit( props: BlockEditProps< CommentEditLinkAttributes > ) { const { attributes, setAttributes } = props; const { linkTarget } = attributes; useDeprecatedTextAlign( props ); const blockProps = useBlockProps(); const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const inspectorControls = ( { setAttributes( { linkTarget: '_self', } ); } } dropdownMenuProps={ dropdownMenuProps } > linkTarget === '_blank' } onDeselect={ () => setAttributes( { linkTarget: '_self' } ) } > setAttributes( { linkTarget: value ? '_blank' : '_self', } ) } checked={ linkTarget === '_blank' } /> ); return ( <> { inspectorControls }
event.preventDefault() } > { __( 'Edit' ) }
); }