/** * WordPress dependencies */ import { __ } from '@wordpress/i18n'; import { createInterpolateElement, useContext } from '@wordpress/element'; import { isAppleOS } from '@wordpress/keycodes'; import { ToggleControl } from '@wordpress/components'; import { Stack, Text } from '@wordpress/ui'; /** * Internal dependencies */ import { AdminContext } from '../../index'; import { useSearchVisibility } from '../index'; import ItemHelp from '../components/item-help'; export default function ColumnSelection() { const { editorOptions, setEditorOptions } = useContext( AdminContext ); const title = __( 'Enable column selection', 'custom-html-block-extension' ); const isVisible = useSearchVisibility( title ); if ( ! isVisible ) { return null; } const onChange = ( value: boolean ) => { setEditorOptions( { ...editorOptions, columnSelection: value, } ); }; return ( }> { isAppleOS() ? createInterpolateElement( __( 'Always enable column selection. Even when disabled, you can make a column selection with Shift + Option + drag mouse, or Shift + Option + Command + arrow key.', 'custom-html-block-extension' ), { code: , } ) : createInterpolateElement( __( 'Always enable column selection. Even when disabled, you can make a column selection with Shift + Alt + drag mouse, or Ctrl + Shift + Alt + arrow key.', 'custom-html-block-extension' ), { code: , } ) } } isToggle defaultToggle={ false } image="editor-options/column-selection.gif" value={ editorOptions.columnSelection } /> ); }