components key events gutenberg
import { KeyboardShortcuts } from '@wordpress/components';
import { withState } from '@wordpress/compose';
const MyKeyboardShortcuts = withState( {
isAllSelected: false,
} )( ( { isAllSelected, setState } ) => {
const selectAll = () => {
setState( { isAllSelected: true } )
};
return (
<div>
<KeyboardShortcuts shortcuts={ {
'mod+a': selectAll,
} } />
[cmd/ctrl + A] Combination pressed? { isAllSelected ? 'Yes' : 'No' }
</div>
)
} )
Are there any code examples left?
New code examples in category TypeScript