Edit File by line
/home/zeestwma/richards.../wp-inclu.../js/dist
File: keycodes.js
/******/ (() => { // webpackBootstrap
[0] Fix | Delete
/******/ "use strict";
[1] Fix | Delete
/******/ // The require scope
[2] Fix | Delete
/******/ var __webpack_require__ = {};
[3] Fix | Delete
/******/
[4] Fix | Delete
/************************************************************************/
[5] Fix | Delete
/******/ /* webpack/runtime/define property getters */
[6] Fix | Delete
/******/ (() => {
[7] Fix | Delete
/******/ // define getter functions for harmony exports
[8] Fix | Delete
/******/ __webpack_require__.d = (exports, definition) => {
[9] Fix | Delete
/******/ for(var key in definition) {
[10] Fix | Delete
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
[11] Fix | Delete
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
[12] Fix | Delete
/******/ }
[13] Fix | Delete
/******/ }
[14] Fix | Delete
/******/ };
[15] Fix | Delete
/******/ })();
[16] Fix | Delete
/******/
[17] Fix | Delete
/******/ /* webpack/runtime/hasOwnProperty shorthand */
[18] Fix | Delete
/******/ (() => {
[19] Fix | Delete
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
[20] Fix | Delete
/******/ })();
[21] Fix | Delete
/******/
[22] Fix | Delete
/******/ /* webpack/runtime/make namespace object */
[23] Fix | Delete
/******/ (() => {
[24] Fix | Delete
/******/ // define __esModule on exports
[25] Fix | Delete
/******/ __webpack_require__.r = (exports) => {
[26] Fix | Delete
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
[27] Fix | Delete
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
[28] Fix | Delete
/******/ }
[29] Fix | Delete
/******/ Object.defineProperty(exports, '__esModule', { value: true });
[30] Fix | Delete
/******/ };
[31] Fix | Delete
/******/ })();
[32] Fix | Delete
/******/
[33] Fix | Delete
/************************************************************************/
[34] Fix | Delete
var __webpack_exports__ = {};
[35] Fix | Delete
// ESM COMPAT FLAG
[36] Fix | Delete
__webpack_require__.r(__webpack_exports__);
[37] Fix | Delete
[38] Fix | Delete
// EXPORTS
[39] Fix | Delete
__webpack_require__.d(__webpack_exports__, {
[40] Fix | Delete
ALT: () => (/* binding */ ALT),
[41] Fix | Delete
BACKSPACE: () => (/* binding */ BACKSPACE),
[42] Fix | Delete
COMMAND: () => (/* binding */ COMMAND),
[43] Fix | Delete
CTRL: () => (/* binding */ CTRL),
[44] Fix | Delete
DELETE: () => (/* binding */ DELETE),
[45] Fix | Delete
DOWN: () => (/* binding */ DOWN),
[46] Fix | Delete
END: () => (/* binding */ END),
[47] Fix | Delete
ENTER: () => (/* binding */ ENTER),
[48] Fix | Delete
ESCAPE: () => (/* binding */ ESCAPE),
[49] Fix | Delete
F10: () => (/* binding */ F10),
[50] Fix | Delete
HOME: () => (/* binding */ HOME),
[51] Fix | Delete
LEFT: () => (/* binding */ LEFT),
[52] Fix | Delete
PAGEDOWN: () => (/* binding */ PAGEDOWN),
[53] Fix | Delete
PAGEUP: () => (/* binding */ PAGEUP),
[54] Fix | Delete
RIGHT: () => (/* binding */ RIGHT),
[55] Fix | Delete
SHIFT: () => (/* binding */ SHIFT),
[56] Fix | Delete
SPACE: () => (/* binding */ SPACE),
[57] Fix | Delete
TAB: () => (/* binding */ TAB),
[58] Fix | Delete
UP: () => (/* binding */ UP),
[59] Fix | Delete
ZERO: () => (/* binding */ ZERO),
[60] Fix | Delete
displayShortcut: () => (/* binding */ displayShortcut),
[61] Fix | Delete
displayShortcutList: () => (/* binding */ displayShortcutList),
[62] Fix | Delete
isAppleOS: () => (/* reexport */ isAppleOS),
[63] Fix | Delete
isKeyboardEvent: () => (/* binding */ isKeyboardEvent),
[64] Fix | Delete
modifiers: () => (/* binding */ modifiers),
[65] Fix | Delete
rawShortcut: () => (/* binding */ rawShortcut),
[66] Fix | Delete
shortcutAriaLabel: () => (/* binding */ shortcutAriaLabel)
[67] Fix | Delete
});
[68] Fix | Delete
[69] Fix | Delete
;// external ["wp","i18n"]
[70] Fix | Delete
const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
[71] Fix | Delete
;// ./node_modules/@wordpress/keycodes/build-module/platform.js
[72] Fix | Delete
/**
[73] Fix | Delete
* Return true if platform is MacOS.
[74] Fix | Delete
*
[75] Fix | Delete
* @param {Window?} _window window object by default; used for DI testing.
[76] Fix | Delete
*
[77] Fix | Delete
* @return {boolean} True if MacOS; false otherwise.
[78] Fix | Delete
*/
[79] Fix | Delete
function isAppleOS(_window = null) {
[80] Fix | Delete
if (!_window) {
[81] Fix | Delete
if (typeof window === 'undefined') {
[82] Fix | Delete
return false;
[83] Fix | Delete
}
[84] Fix | Delete
_window = window;
[85] Fix | Delete
}
[86] Fix | Delete
const {
[87] Fix | Delete
platform
[88] Fix | Delete
} = _window.navigator;
[89] Fix | Delete
return platform.indexOf('Mac') !== -1 || ['iPad', 'iPhone'].includes(platform);
[90] Fix | Delete
}
[91] Fix | Delete
[92] Fix | Delete
;// ./node_modules/@wordpress/keycodes/build-module/index.js
[93] Fix | Delete
/**
[94] Fix | Delete
* Note: The order of the modifier keys in many of the [foo]Shortcut()
[95] Fix | Delete
* functions in this file are intentional and should not be changed. They're
[96] Fix | Delete
* designed to fit with the standard menu keyboard shortcuts shown in the
[97] Fix | Delete
* user's platform.
[98] Fix | Delete
*
[99] Fix | Delete
* For example, on MacOS menu shortcuts will place Shift before Command, but
[100] Fix | Delete
* on Windows Control will usually come first. So don't provide your own
[101] Fix | Delete
* shortcut combos directly to keyboardShortcut().
[102] Fix | Delete
*/
[103] Fix | Delete
[104] Fix | Delete
/**
[105] Fix | Delete
* WordPress dependencies
[106] Fix | Delete
*/
[107] Fix | Delete
[108] Fix | Delete
[109] Fix | Delete
/**
[110] Fix | Delete
* Internal dependencies
[111] Fix | Delete
*/
[112] Fix | Delete
[113] Fix | Delete
[114] Fix | Delete
/** @typedef {typeof ALT | CTRL | COMMAND | SHIFT } WPModifierPart */
[115] Fix | Delete
[116] Fix | Delete
/** @typedef {'primary' | 'primaryShift' | 'primaryAlt' | 'secondary' | 'access' | 'ctrl' | 'alt' | 'ctrlShift' | 'shift' | 'shiftAlt' | 'undefined'} WPKeycodeModifier */
[117] Fix | Delete
[118] Fix | Delete
/**
[119] Fix | Delete
* An object of handler functions for each of the possible modifier
[120] Fix | Delete
* combinations. A handler will return a value for a given key.
[121] Fix | Delete
*
[122] Fix | Delete
* @template T
[123] Fix | Delete
*
[124] Fix | Delete
* @typedef {Record<WPKeycodeModifier, T>} WPModifierHandler
[125] Fix | Delete
*/
[126] Fix | Delete
[127] Fix | Delete
/**
[128] Fix | Delete
* @template T
[129] Fix | Delete
*
[130] Fix | Delete
* @typedef {(character: string, isApple?: () => boolean) => T} WPKeyHandler
[131] Fix | Delete
*/
[132] Fix | Delete
/** @typedef {(event: import('react').KeyboardEvent<HTMLElement> | KeyboardEvent, character: string, isApple?: () => boolean) => boolean} WPEventKeyHandler */
[133] Fix | Delete
[134] Fix | Delete
/** @typedef {( isApple: () => boolean ) => WPModifierPart[]} WPModifier */
[135] Fix | Delete
[136] Fix | Delete
/**
[137] Fix | Delete
* Keycode for BACKSPACE key.
[138] Fix | Delete
*/
[139] Fix | Delete
const BACKSPACE = 8;
[140] Fix | Delete
[141] Fix | Delete
/**
[142] Fix | Delete
* Keycode for TAB key.
[143] Fix | Delete
*/
[144] Fix | Delete
const TAB = 9;
[145] Fix | Delete
[146] Fix | Delete
/**
[147] Fix | Delete
* Keycode for ENTER key.
[148] Fix | Delete
*/
[149] Fix | Delete
const ENTER = 13;
[150] Fix | Delete
[151] Fix | Delete
/**
[152] Fix | Delete
* Keycode for ESCAPE key.
[153] Fix | Delete
*/
[154] Fix | Delete
const ESCAPE = 27;
[155] Fix | Delete
[156] Fix | Delete
/**
[157] Fix | Delete
* Keycode for SPACE key.
[158] Fix | Delete
*/
[159] Fix | Delete
const SPACE = 32;
[160] Fix | Delete
[161] Fix | Delete
/**
[162] Fix | Delete
* Keycode for PAGEUP key.
[163] Fix | Delete
*/
[164] Fix | Delete
const PAGEUP = 33;
[165] Fix | Delete
[166] Fix | Delete
/**
[167] Fix | Delete
* Keycode for PAGEDOWN key.
[168] Fix | Delete
*/
[169] Fix | Delete
const PAGEDOWN = 34;
[170] Fix | Delete
[171] Fix | Delete
/**
[172] Fix | Delete
* Keycode for END key.
[173] Fix | Delete
*/
[174] Fix | Delete
const END = 35;
[175] Fix | Delete
[176] Fix | Delete
/**
[177] Fix | Delete
* Keycode for HOME key.
[178] Fix | Delete
*/
[179] Fix | Delete
const HOME = 36;
[180] Fix | Delete
[181] Fix | Delete
/**
[182] Fix | Delete
* Keycode for LEFT key.
[183] Fix | Delete
*/
[184] Fix | Delete
const LEFT = 37;
[185] Fix | Delete
[186] Fix | Delete
/**
[187] Fix | Delete
* Keycode for UP key.
[188] Fix | Delete
*/
[189] Fix | Delete
const UP = 38;
[190] Fix | Delete
[191] Fix | Delete
/**
[192] Fix | Delete
* Keycode for RIGHT key.
[193] Fix | Delete
*/
[194] Fix | Delete
const RIGHT = 39;
[195] Fix | Delete
[196] Fix | Delete
/**
[197] Fix | Delete
* Keycode for DOWN key.
[198] Fix | Delete
*/
[199] Fix | Delete
const DOWN = 40;
[200] Fix | Delete
[201] Fix | Delete
/**
[202] Fix | Delete
* Keycode for DELETE key.
[203] Fix | Delete
*/
[204] Fix | Delete
const DELETE = 46;
[205] Fix | Delete
[206] Fix | Delete
/**
[207] Fix | Delete
* Keycode for F10 key.
[208] Fix | Delete
*/
[209] Fix | Delete
const F10 = 121;
[210] Fix | Delete
[211] Fix | Delete
/**
[212] Fix | Delete
* Keycode for ALT key.
[213] Fix | Delete
*/
[214] Fix | Delete
const ALT = 'alt';
[215] Fix | Delete
[216] Fix | Delete
/**
[217] Fix | Delete
* Keycode for CTRL key.
[218] Fix | Delete
*/
[219] Fix | Delete
const CTRL = 'ctrl';
[220] Fix | Delete
[221] Fix | Delete
/**
[222] Fix | Delete
* Keycode for COMMAND/META key.
[223] Fix | Delete
*/
[224] Fix | Delete
const COMMAND = 'meta';
[225] Fix | Delete
[226] Fix | Delete
/**
[227] Fix | Delete
* Keycode for SHIFT key.
[228] Fix | Delete
*/
[229] Fix | Delete
const SHIFT = 'shift';
[230] Fix | Delete
[231] Fix | Delete
/**
[232] Fix | Delete
* Keycode for ZERO key.
[233] Fix | Delete
*/
[234] Fix | Delete
const ZERO = 48;
[235] Fix | Delete
[236] Fix | Delete
[237] Fix | Delete
/**
[238] Fix | Delete
* Capitalise the first character of a string.
[239] Fix | Delete
* @param {string} string String to capitalise.
[240] Fix | Delete
* @return {string} Capitalised string.
[241] Fix | Delete
*/
[242] Fix | Delete
function capitaliseFirstCharacter(string) {
[243] Fix | Delete
return string.length < 2 ? string.toUpperCase() : string.charAt(0).toUpperCase() + string.slice(1);
[244] Fix | Delete
}
[245] Fix | Delete
[246] Fix | Delete
/**
[247] Fix | Delete
* Map the values of an object with a specified callback and return the result object.
[248] Fix | Delete
*
[249] Fix | Delete
* @template {{ [s: string]: any; } | ArrayLike<any>} T
[250] Fix | Delete
*
[251] Fix | Delete
* @param {T} object Object to map values of.
[252] Fix | Delete
* @param {( value: any ) => any} mapFn Mapping function
[253] Fix | Delete
*
[254] Fix | Delete
* @return {any} Active modifier constants.
[255] Fix | Delete
*/
[256] Fix | Delete
function mapValues(object, mapFn) {
[257] Fix | Delete
return Object.fromEntries(Object.entries(object).map(([key, value]) => [key, mapFn(value)]));
[258] Fix | Delete
}
[259] Fix | Delete
[260] Fix | Delete
/**
[261] Fix | Delete
* Object that contains functions that return the available modifier
[262] Fix | Delete
* depending on platform.
[263] Fix | Delete
*
[264] Fix | Delete
* @type {WPModifierHandler< ( isApple: () => boolean ) => WPModifierPart[]>}
[265] Fix | Delete
*/
[266] Fix | Delete
const modifiers = {
[267] Fix | Delete
primary: _isApple => _isApple() ? [COMMAND] : [CTRL],
[268] Fix | Delete
primaryShift: _isApple => _isApple() ? [SHIFT, COMMAND] : [CTRL, SHIFT],
[269] Fix | Delete
primaryAlt: _isApple => _isApple() ? [ALT, COMMAND] : [CTRL, ALT],
[270] Fix | Delete
secondary: _isApple => _isApple() ? [SHIFT, ALT, COMMAND] : [CTRL, SHIFT, ALT],
[271] Fix | Delete
access: _isApple => _isApple() ? [CTRL, ALT] : [SHIFT, ALT],
[272] Fix | Delete
ctrl: () => [CTRL],
[273] Fix | Delete
alt: () => [ALT],
[274] Fix | Delete
ctrlShift: () => [CTRL, SHIFT],
[275] Fix | Delete
shift: () => [SHIFT],
[276] Fix | Delete
shiftAlt: () => [SHIFT, ALT],
[277] Fix | Delete
undefined: () => []
[278] Fix | Delete
};
[279] Fix | Delete
[280] Fix | Delete
/**
[281] Fix | Delete
* An object that contains functions to get raw shortcuts.
[282] Fix | Delete
*
[283] Fix | Delete
* These are intended for user with the KeyboardShortcuts.
[284] Fix | Delete
*
[285] Fix | Delete
* @example
[286] Fix | Delete
* ```js
[287] Fix | Delete
* // Assuming macOS:
[288] Fix | Delete
* rawShortcut.primary( 'm' )
[289] Fix | Delete
* // "meta+m""
[290] Fix | Delete
* ```
[291] Fix | Delete
*
[292] Fix | Delete
* @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to raw
[293] Fix | Delete
* shortcuts.
[294] Fix | Delete
*/
[295] Fix | Delete
const rawShortcut = /* @__PURE__ */
[296] Fix | Delete
mapValues(modifiers, (/** @type {WPModifier} */modifier) => {
[297] Fix | Delete
return /** @type {WPKeyHandler<string>} */(character, _isApple = isAppleOS) => {
[298] Fix | Delete
return [...modifier(_isApple), character.toLowerCase()].join('+');
[299] Fix | Delete
};
[300] Fix | Delete
});
[301] Fix | Delete
[302] Fix | Delete
/**
[303] Fix | Delete
* Return an array of the parts of a keyboard shortcut chord for display.
[304] Fix | Delete
*
[305] Fix | Delete
* @example
[306] Fix | Delete
* ```js
[307] Fix | Delete
* // Assuming macOS:
[308] Fix | Delete
* displayShortcutList.primary( 'm' );
[309] Fix | Delete
* // [ "⌘", "M" ]
[310] Fix | Delete
* ```
[311] Fix | Delete
*
[312] Fix | Delete
* @type {WPModifierHandler<WPKeyHandler<string[]>>} Keyed map of functions to
[313] Fix | Delete
* shortcut sequences.
[314] Fix | Delete
*/
[315] Fix | Delete
const displayShortcutList = /* @__PURE__ */
[316] Fix | Delete
mapValues(modifiers, (/** @type {WPModifier} */modifier) => {
[317] Fix | Delete
return /** @type {WPKeyHandler<string[]>} */(character, _isApple = isAppleOS) => {
[318] Fix | Delete
const isApple = _isApple();
[319] Fix | Delete
const replacementKeyMap = {
[320] Fix | Delete
[ALT]: isApple ? '⌥' : 'Alt',
[321] Fix | Delete
[CTRL]: isApple ? '⌃' : 'Ctrl',
[322] Fix | Delete
// Make sure ⌃ is the U+2303 UP ARROWHEAD unicode character and not the caret character.
[323] Fix | Delete
[COMMAND]: '⌘',
[324] Fix | Delete
[SHIFT]: isApple ? '⇧' : 'Shift'
[325] Fix | Delete
};
[326] Fix | Delete
const modifierKeys = modifier(_isApple).reduce((accumulator, key) => {
[327] Fix | Delete
var _replacementKeyMap$ke;
[328] Fix | Delete
const replacementKey = (_replacementKeyMap$ke = replacementKeyMap[key]) !== null && _replacementKeyMap$ke !== void 0 ? _replacementKeyMap$ke : key;
[329] Fix | Delete
// If on the Mac, adhere to platform convention and don't show plus between keys.
[330] Fix | Delete
if (isApple) {
[331] Fix | Delete
return [...accumulator, replacementKey];
[332] Fix | Delete
}
[333] Fix | Delete
return [...accumulator, replacementKey, '+'];
[334] Fix | Delete
}, /** @type {string[]} */[]);
[335] Fix | Delete
return [...modifierKeys, capitaliseFirstCharacter(character)];
[336] Fix | Delete
};
[337] Fix | Delete
});
[338] Fix | Delete
[339] Fix | Delete
/**
[340] Fix | Delete
* An object that contains functions to display shortcuts.
[341] Fix | Delete
*
[342] Fix | Delete
* @example
[343] Fix | Delete
* ```js
[344] Fix | Delete
* // Assuming macOS:
[345] Fix | Delete
* displayShortcut.primary( 'm' );
[346] Fix | Delete
* // "⌘M"
[347] Fix | Delete
* ```
[348] Fix | Delete
*
[349] Fix | Delete
* @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to
[350] Fix | Delete
* display shortcuts.
[351] Fix | Delete
*/
[352] Fix | Delete
const displayShortcut = /* @__PURE__ */
[353] Fix | Delete
mapValues(displayShortcutList, (/** @type {WPKeyHandler<string[]>} */shortcutList) => {
[354] Fix | Delete
return /** @type {WPKeyHandler<string>} */(character, _isApple = isAppleOS) => shortcutList(character, _isApple).join('');
[355] Fix | Delete
});
[356] Fix | Delete
[357] Fix | Delete
/**
[358] Fix | Delete
* An object that contains functions to return an aria label for a keyboard
[359] Fix | Delete
* shortcut.
[360] Fix | Delete
*
[361] Fix | Delete
* @example
[362] Fix | Delete
* ```js
[363] Fix | Delete
* // Assuming macOS:
[364] Fix | Delete
* shortcutAriaLabel.primary( '.' );
[365] Fix | Delete
* // "Command + Period"
[366] Fix | Delete
* ```
[367] Fix | Delete
*
[368] Fix | Delete
* @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to
[369] Fix | Delete
* shortcut ARIA labels.
[370] Fix | Delete
*/
[371] Fix | Delete
const shortcutAriaLabel = /* @__PURE__ */
[372] Fix | Delete
mapValues(modifiers, (/** @type {WPModifier} */modifier) => {
[373] Fix | Delete
return /** @type {WPKeyHandler<string>} */(character, _isApple = isAppleOS) => {
[374] Fix | Delete
const isApple = _isApple();
[375] Fix | Delete
/** @type {Record<string,string>} */
[376] Fix | Delete
const replacementKeyMap = {
[377] Fix | Delete
[SHIFT]: 'Shift',
[378] Fix | Delete
[COMMAND]: isApple ? 'Command' : 'Control',
[379] Fix | Delete
[CTRL]: 'Control',
[380] Fix | Delete
[ALT]: isApple ? 'Option' : 'Alt',
[381] Fix | Delete
/* translators: comma as in the character ',' */
[382] Fix | Delete
',': (0,external_wp_i18n_namespaceObject.__)('Comma'),
[383] Fix | Delete
/* translators: period as in the character '.' */
[384] Fix | Delete
'.': (0,external_wp_i18n_namespaceObject.__)('Period'),
[385] Fix | Delete
/* translators: backtick as in the character '`' */
[386] Fix | Delete
'`': (0,external_wp_i18n_namespaceObject.__)('Backtick'),
[387] Fix | Delete
/* translators: tilde as in the character '~' */
[388] Fix | Delete
'~': (0,external_wp_i18n_namespaceObject.__)('Tilde')
[389] Fix | Delete
};
[390] Fix | Delete
return [...modifier(_isApple), character].map(key => {
[391] Fix | Delete
var _replacementKeyMap$ke2;
[392] Fix | Delete
return capitaliseFirstCharacter((_replacementKeyMap$ke2 = replacementKeyMap[key]) !== null && _replacementKeyMap$ke2 !== void 0 ? _replacementKeyMap$ke2 : key);
[393] Fix | Delete
}).join(isApple ? ' ' : ' + ');
[394] Fix | Delete
};
[395] Fix | Delete
});
[396] Fix | Delete
[397] Fix | Delete
/**
[398] Fix | Delete
* From a given KeyboardEvent, returns an array of active modifier constants for
[399] Fix | Delete
* the event.
[400] Fix | Delete
*
[401] Fix | Delete
* @param {import('react').KeyboardEvent<HTMLElement> | KeyboardEvent} event Keyboard event.
[402] Fix | Delete
*
[403] Fix | Delete
* @return {Array<WPModifierPart>} Active modifier constants.
[404] Fix | Delete
*/
[405] Fix | Delete
function getEventModifiers(event) {
[406] Fix | Delete
return /** @type {WPModifierPart[]} */[ALT, CTRL, COMMAND, SHIFT].filter(key => event[(/** @type {'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'} */
[407] Fix | Delete
`${key}Key`)]);
[408] Fix | Delete
}
[409] Fix | Delete
[410] Fix | Delete
/**
[411] Fix | Delete
* An object that contains functions to check if a keyboard event matches a
[412] Fix | Delete
* predefined shortcut combination.
[413] Fix | Delete
*
[414] Fix | Delete
* @example
[415] Fix | Delete
* ```js
[416] Fix | Delete
* // Assuming an event for ⌘M key press:
[417] Fix | Delete
* isKeyboardEvent.primary( event, 'm' );
[418] Fix | Delete
* // true
[419] Fix | Delete
* ```
[420] Fix | Delete
*
[421] Fix | Delete
* @type {WPModifierHandler<WPEventKeyHandler>} Keyed map of functions
[422] Fix | Delete
* to match events.
[423] Fix | Delete
*/
[424] Fix | Delete
const isKeyboardEvent = /* @__PURE__ */
[425] Fix | Delete
mapValues(modifiers, (/** @type {WPModifier} */getModifiers) => {
[426] Fix | Delete
return /** @type {WPEventKeyHandler} */(event, character, _isApple = isAppleOS) => {
[427] Fix | Delete
const mods = getModifiers(_isApple);
[428] Fix | Delete
const eventMods = getEventModifiers(event);
[429] Fix | Delete
/** @type {Record<string,string>} */
[430] Fix | Delete
const replacementWithShiftKeyMap = {
[431] Fix | Delete
Comma: ',',
[432] Fix | Delete
Backslash: '\\',
[433] Fix | Delete
// Windows returns `\` for both IntlRo and IntlYen.
[434] Fix | Delete
IntlRo: '\\',
[435] Fix | Delete
IntlYen: '\\'
[436] Fix | Delete
};
[437] Fix | Delete
const modsDiff = mods.filter(mod => !eventMods.includes(mod));
[438] Fix | Delete
const eventModsDiff = eventMods.filter(mod => !mods.includes(mod));
[439] Fix | Delete
if (modsDiff.length > 0 || eventModsDiff.length > 0) {
[440] Fix | Delete
return false;
[441] Fix | Delete
}
[442] Fix | Delete
let key = event.key.toLowerCase();
[443] Fix | Delete
if (!character) {
[444] Fix | Delete
return mods.includes(/** @type {WPModifierPart} */key);
[445] Fix | Delete
}
[446] Fix | Delete
if (event.altKey && character.length === 1) {
[447] Fix | Delete
key = String.fromCharCode(event.keyCode).toLowerCase();
[448] Fix | Delete
}
[449] Fix | Delete
[450] Fix | Delete
// `event.key` returns the value of the key pressed, taking into the state of
[451] Fix | Delete
// modifier keys such as `Shift`. If the shift key is pressed, a different
[452] Fix | Delete
// value may be returned depending on the keyboard layout. It is necessary to
[453] Fix | Delete
// convert to the physical key value that don't take into account keyboard
[454] Fix | Delete
// layout or modifier key state.
[455] Fix | Delete
if (event.shiftKey && character.length === 1 && replacementWithShiftKeyMap[event.code]) {
[456] Fix | Delete
key = replacementWithShiftKeyMap[event.code];
[457] Fix | Delete
}
[458] Fix | Delete
[459] Fix | Delete
// For backwards compatibility.
[460] Fix | Delete
if (character === 'del') {
[461] Fix | Delete
character = 'delete';
[462] Fix | Delete
}
[463] Fix | Delete
return key === character.toLowerCase();
[464] Fix | Delete
};
[465] Fix | Delete
});
[466] Fix | Delete
[467] Fix | Delete
(window.wp = window.wp || {}).keycodes = __webpack_exports__;
[468] Fix | Delete
/******/ })()
[469] Fix | Delete
;
[470] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function