UNPKG

@gechiui/block-editor

Version:
127 lines (119 loc) 3.36 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _element = require("@gechiui/element"); var _data = require("@gechiui/data"); var _keyboardShortcuts = require("@gechiui/keyboard-shortcuts"); var _i18n = require("@gechiui/i18n"); /** * GeChiUI 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/duplicate', category: 'block', description: (0, _i18n.__)('复制选定的区块。'), keyCombination: { modifier: 'primaryShift', character: 'd' } }); registerShortcut({ name: 'core/block-editor/remove', category: 'block', description: (0, _i18n.__)('移除选定的区块。'), keyCombination: { modifier: 'access', character: 'z' } }); registerShortcut({ name: 'core/block-editor/insert-before', category: 'block', description: (0, _i18n.__)('在选定的区块前插入一个新的区块。'), keyCombination: { modifier: 'primaryAlt', character: 't' } }); registerShortcut({ name: 'core/block-editor/insert-after', category: 'block', description: (0, _i18n.__)('在选定的区块后插入一个新的区块。'), keyCombination: { modifier: 'primaryAlt', character: 'y' } }); registerShortcut({ name: 'core/block-editor/delete-multi-selection', category: 'block', description: (0, _i18n.__)('移除多个选定的区块。'), keyCombination: { character: 'del' }, aliases: [{ character: 'backspace' }] }); registerShortcut({ name: 'core/block-editor/select-all', category: 'selection', description: (0, _i18n.__)('在打字时全选文字,再按一次来选择所有的区块。'), keyCombination: { modifier: 'primary', character: 'a' } }); registerShortcut({ name: 'core/block-editor/unselect', category: 'selection', description: (0, _i18n.__)('清除选择。'), keyCombination: { character: 'escape' } }); registerShortcut({ name: 'core/block-editor/focus-toolbar', category: 'global', description: (0, _i18n.__)('导航至最近的工具栏。'), keyCombination: { modifier: 'alt', character: 'F10' } }); registerShortcut({ name: 'core/block-editor/move-up', category: 'block', description: (0, _i18n.__)('将所选区块上移。'), keyCombination: { modifier: 'secondary', character: 't' } }); registerShortcut({ name: 'core/block-editor/move-down', category: 'block', description: (0, _i18n.__)('向下移动所选区块。'), keyCombination: { modifier: 'secondary', character: 'y' } }); }, [registerShortcut]); return null; } KeyboardShortcuts.Register = KeyboardShortcutsRegister; var _default = KeyboardShortcuts; exports.default = _default; //# sourceMappingURL=index.js.map