@wordpress/block-editor
Version:
226 lines (224 loc) • 6.87 kB
JavaScript
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/block-editor/src/components/keyboard-shortcuts/index.js
var keyboard_shortcuts_exports = {};
__export(keyboard_shortcuts_exports, {
default: () => keyboard_shortcuts_default
});
module.exports = __toCommonJS(keyboard_shortcuts_exports);
var import_element = require("@wordpress/element");
var import_data = require("@wordpress/data");
var import_keyboard_shortcuts = require("@wordpress/keyboard-shortcuts");
var import_i18n = require("@wordpress/i18n");
function KeyboardShortcuts() {
return null;
}
function KeyboardShortcutsRegister() {
const { registerShortcut } = (0, import_data.useDispatch)(import_keyboard_shortcuts.store);
(0, import_element.useEffect)(() => {
registerShortcut({
name: "core/block-editor/copy",
category: "block",
description: (0, import_i18n.__)("Copy the selected block(s)."),
keyCombination: {
modifier: "primary",
character: "c"
}
});
registerShortcut({
name: "core/block-editor/cut",
category: "block",
description: (0, import_i18n.__)("Cut the selected block(s)."),
keyCombination: {
modifier: "primary",
character: "x"
}
});
registerShortcut({
name: "core/block-editor/paste",
category: "block",
description: (0, import_i18n.__)("Paste the selected block(s)."),
keyCombination: {
modifier: "primary",
character: "v"
}
});
registerShortcut({
name: "core/block-editor/duplicate",
category: "block",
description: (0, import_i18n.__)("Duplicate the selected block(s)."),
keyCombination: {
modifier: "primaryShift",
character: "d"
}
});
registerShortcut({
name: "core/block-editor/remove",
category: "block",
description: (0, import_i18n.__)("Remove the selected block(s)."),
keyCombination: {
modifier: "access",
character: "z"
}
});
registerShortcut({
name: "core/block-editor/paste-styles",
category: "block",
description: (0, import_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, import_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, import_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, import_i18n.__)("Delete selection."),
keyCombination: {
character: "del"
},
aliases: [
{
character: "backspace"
}
]
});
registerShortcut({
name: "core/block-editor/stop-editing-as-blocks",
category: "block",
description: (0, import_i18n.__)("Finish editing a design."),
keyCombination: {
character: "escape"
}
});
registerShortcut({
name: "core/block-editor/select-all",
category: "selection",
description: (0, import_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, import_i18n.__)("Clear selection."),
keyCombination: {
character: "escape"
}
});
registerShortcut({
name: "core/block-editor/multi-text-selection",
category: "selection",
description: (0, import_i18n.__)("Select text across multiple blocks."),
keyCombination: {
modifier: "shift",
// Spotted during my own research — invalid character?
character: "arrow"
}
});
registerShortcut({
name: "core/block-editor/focus-toolbar",
category: "global",
description: (0, import_i18n.__)("Navigate to the nearest toolbar."),
keyCombination: {
modifier: "alt",
character: "F10"
}
});
registerShortcut({
name: "core/block-editor/move-up",
category: "block",
description: (0, import_i18n.__)("Move the selected block(s) up."),
keyCombination: {
modifier: "secondary",
character: "t"
}
});
registerShortcut({
name: "core/block-editor/move-down",
category: "block",
description: (0, import_i18n.__)("Move the selected block(s) down."),
keyCombination: {
modifier: "secondary",
character: "y"
}
});
registerShortcut({
name: "core/block-editor/collapse-list-view",
category: "list-view",
description: (0, import_i18n.__)("Collapse all other items."),
keyCombination: {
modifier: "alt",
character: "l"
}
});
registerShortcut({
name: "core/block-editor/group",
category: "block",
description: (0, import_i18n.__)(
"Create a group block from the selected multiple blocks."
),
keyCombination: {
modifier: "primary",
character: "g"
}
});
registerShortcut({
name: "core/block-editor/toggle-block-visibility",
category: "block",
description: (0, import_i18n.__)("Show or hide the selected block(s)."),
keyCombination: {
modifier: "primaryShift",
character: "h"
}
});
}, [registerShortcut]);
return null;
}
KeyboardShortcuts.Register = KeyboardShortcutsRegister;
var keyboard_shortcuts_default = KeyboardShortcuts;
//# sourceMappingURL=index.cjs.map