PluginProbe
Gutenberg / 24.1.0
Gutenberg v24.1.0
24.1.0 24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 All 404 releases
← All changes | build/scripts/keyboard-shortcuts/index.js +20 -4 23.2.2 → 24.1.0 View file →
@@ -1,4 +1,5 @@
1 +(function() {
1 2 "use strict";
2 3 var wp;
3 4 (wp ||= {}).keyboardShortcuts = (() => {
4 5 var __create = Object.create;
@@ -127,8 +128,9 @@
127 128 __export(selectors_exports, {
128 129 getAllShortcutKeyCombinations: () => getAllShortcutKeyCombinations,
129 130 getAllShortcutRawKeyCombinations: () => getAllShortcutRawKeyCombinations,
130 131 getCategoryShortcuts: () => getCategoryShortcuts,
132 + getKeyboardShortcut: () => getKeyboardShortcut,
131 133 getShortcutAliases: () => getShortcutAliases,
132 134 getShortcutDescription: () => getShortcutDescription,
133 135 getShortcutKeyCombination: () => getShortcutKeyCombination,
134 136 getShortcutRepresentation: () => getShortcutRepresentation
@@ -164,8 +166,20 @@
164 166 function getShortcutRepresentation(state, name, representation = "display") {
165 167 const shortcut = getShortcutKeyCombination(state, name);
166 168 return getKeyCombinationRepresentation(shortcut, representation);
167 169 }
170 + var getKeyboardShortcut = (0, import_data.createSelector)(
171 + (state, name) => {
172 + const combination = getShortcutKeyCombination(state, name);
173 + if (!combination) {
174 + return null;
175 + }
176 + return import_keycodes.keyboardShortcut[combination.modifier ?? "undefined"](
177 + combination.character
178 + );
179 + },
180 + (state, name) => [state[name]]
181 + );
168 182 function getShortcutDescription(state, name) {
169 183 return state[name] ? state[name].description : null;
170 184 }
171 185 function getShortcutAliases(state, name) {
@@ -235,10 +249,10 @@
235 249 // packages/keyboard-shortcuts/build-module/context.mjs
236 250 var import_element2 = __toESM(require_element(), 1);
237 251 var globalShortcuts = /* @__PURE__ */ new Set();
238 252 var globalListener = (event) => {
239 - for (const keyboardShortcut of globalShortcuts) {
240 - keyboardShortcut(event);
253 + for (const keyboardShortcut2 of globalShortcuts) {
254 + keyboardShortcut2(event);
241 255 }
242 256 };
243 257 var context = (0, import_element2.createContext)({
244 258 add: (shortcut) => {
@@ -292,13 +306,15 @@
292 306 if (props.onKeyDown) {
293 307 props.onKeyDown(event);
294 308 }
295 309 const nativeEvent = event.nativeEvent;
296 - for (const keyboardShortcut of keyboardShortcuts) {
297 - keyboardShortcut(nativeEvent);
310 + for (const keyboardShortcut2 of keyboardShortcuts) {
311 + keyboardShortcut2(nativeEvent);
298 312 }
299 313 }
300 314 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider, { value: keyboardShortcuts, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...props, onKeyDown }) });
301 315 }
302 316 return __toCommonJS(index_exports);
317 +})();
318 +(window.wp ||= {}).keyboardShortcuts = wp.keyboardShortcuts;
303 319 })();
304 320 //# sourceMappingURL=index.js.map