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 +17 -4 23.9.1 → 24.1.0 View file →
@@ -128,8 +128,9 @@
128 128 __export(selectors_exports, {
129 129 getAllShortcutKeyCombinations: () => getAllShortcutKeyCombinations,
130 130 getAllShortcutRawKeyCombinations: () => getAllShortcutRawKeyCombinations,
131 131 getCategoryShortcuts: () => getCategoryShortcuts,
132 + getKeyboardShortcut: () => getKeyboardShortcut,
132 133 getShortcutAliases: () => getShortcutAliases,
133 134 getShortcutDescription: () => getShortcutDescription,
134 135 getShortcutKeyCombination: () => getShortcutKeyCombination,
135 136 getShortcutRepresentation: () => getShortcutRepresentation
@@ -165,8 +166,20 @@
165 166 function getShortcutRepresentation(state, name, representation = "display") {
166 167 const shortcut = getShortcutKeyCombination(state, name);
167 168 return getKeyCombinationRepresentation(shortcut, representation);
168 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 + );
169 182 function getShortcutDescription(state, name) {
170 183 return state[name] ? state[name].description : null;
171 184 }
172 185 function getShortcutAliases(state, name) {
@@ -236,10 +249,10 @@
236 249 // packages/keyboard-shortcuts/build-module/context.mjs
237 250 var import_element2 = __toESM(require_element(), 1);
238 251 var globalShortcuts = /* @__PURE__ */ new Set();
239 252 var globalListener = (event) => {
240 - for (const keyboardShortcut of globalShortcuts) {
241 - keyboardShortcut(event);
253 + for (const keyboardShortcut2 of globalShortcuts) {
254 + keyboardShortcut2(event);
242 255 }
243 256 };
244 257 var context = (0, import_element2.createContext)({
245 258 add: (shortcut) => {
@@ -293,10 +306,10 @@
293 306 if (props.onKeyDown) {
294 307 props.onKeyDown(event);
295 308 }
296 309 const nativeEvent = event.nativeEvent;
297 - for (const keyboardShortcut of keyboardShortcuts) {
298 - keyboardShortcut(nativeEvent);
310 + for (const keyboardShortcut2 of keyboardShortcuts) {
311 + keyboardShortcut2(nativeEvent);
299 312 }
300 313 }
301 314 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider, { value: keyboardShortcuts, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...props, onKeyDown }) });
302 315 }