UNPKG

@wordpress/block-editor

Version:
185 lines (182 loc) 5.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _element = require("@wordpress/element"); var _data = require("@wordpress/data"); var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts"); var _i18n = require("@wordpress/i18n"); /** * WordPress dependencies */ function KeyboardShortcuts() { return null; } function KeyboardShortcutsRegister() { // Registering the shortcuts. const { registerShortcut } = (0, _data.useDispatch)(_keyboardShortcuts.store); (0, _element.useEffect)(() => { registerShortcut({ name: 'core/block-editor/copy', category: 'block', description: (0, _i18n.__)('Copy the selected block(s).'), keyCombination: { modifier: 'primary', character: 'c' } }); registerShortcut({ name: 'core/block-editor/cut', category: 'block', description: (0, _i18n.__)('Cut the selected block(s).'), keyCombination: { modifier: 'primary', character: 'x' } }); registerShortcut({ name: 'core/block-editor/paste', category: 'block', description: (0, _i18n.__)('Paste the selected block(s).'), keyCombination: { modifier: 'primary', character: 'v' } }); registerShortcut({ name: 'core/block-editor/duplicate', category: 'block', description: (0, _i18n.__)('Duplicate the selected block(s).'), keyCombination: { modifier: 'primaryShift', character: 'd' } }); registerShortcut({ name: 'core/block-editor/remove', category: 'block', description: (0, _i18n.__)('Remove the selected block(s).'), keyCombination: { modifier: 'primaryShift', character: 'backspace' } }); registerShortcut({ name: 'core/block-editor/paste-styles', category: 'block', description: (0, _i18n.__)('Paste the copied style to the selected block(s).'), keyCombination: { modifier: 'primaryAlt', character: 'v' } }); registerShortcut({ name: 'core/block-editor/insert-before', category: 'block', description: (0, _i18n.__)('Insert a new block before the selected block(s).'), keyCombination: { modifier: 'primaryAlt', character: 't' } }); registerShortcut({ name: 'core/block-editor/insert-after', category: 'block', description: (0, _i18n.__)('Insert a new block after the selected block(s).'), keyCombination: { modifier: 'primaryAlt', character: 'y' } }); registerShortcut({ name: 'core/block-editor/delete-multi-selection', category: 'block', description: (0, _i18n.__)('Delete selection.'), keyCombination: { character: 'del' }, aliases: [{ character: 'backspace' }] }); registerShortcut({ name: 'core/block-editor/select-all', category: 'selection', description: (0, _i18n.__)('Select all text when typing. Press again to select all blocks.'), keyCombination: { modifier: 'primary', character: 'a' } }); registerShortcut({ name: 'core/block-editor/unselect', category: 'selection', description: (0, _i18n.__)('Clear selection.'), keyCombination: { character: 'escape' } }); registerShortcut({ name: 'core/block-editor/multi-text-selection', category: 'selection', description: (0, _i18n.__)('Select text across multiple blocks.'), keyCombination: { modifier: 'shift', character: 'arrow' } }); registerShortcut({ name: 'core/block-editor/focus-toolbar', category: 'global', description: (0, _i18n.__)('Navigate to the nearest toolbar.'), keyCombination: { modifier: 'alt', character: 'F10' } }); registerShortcut({ name: 'core/block-editor/move-up', category: 'block', description: (0, _i18n.__)('Move the selected block(s) up.'), keyCombination: { modifier: 'secondary', character: 't' } }); registerShortcut({ name: 'core/block-editor/move-down', category: 'block', description: (0, _i18n.__)('Move the selected block(s) down.'), keyCombination: { modifier: 'secondary', character: 'y' } }); // List view shortcuts. registerShortcut({ name: 'core/block-editor/collapse-list-view', category: 'list-view', description: (0, _i18n.__)('Collapse all other items.'), keyCombination: { modifier: 'alt', character: 'l' } }); registerShortcut({ name: 'core/block-editor/group', category: 'block', description: (0, _i18n.__)('Create a group block from the selected multiple blocks.'), keyCombination: { modifier: 'primary', character: 'g' } }); }, [registerShortcut]); return null; } KeyboardShortcuts.Register = KeyboardShortcutsRegister; var _default = exports.default = KeyboardShortcuts; //# sourceMappingURL=index.js.map