handsontable 0.0.0-next-301795f-20231127 → 0.0.0-next-1aba9db-20231128
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/3rdparty/walkontable/src/renderer/columnHeaders.js +4 -1
- package/3rdparty/walkontable/src/renderer/columnHeaders.mjs +4 -1
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +61 -29
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +6 -6
- package/dist/handsontable.js +61 -29
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +6 -6
- package/focusManager.js +43 -21
- package/focusManager.mjs +43 -21
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/plugins/contextMenu/contextMenu.js +1 -1
- package/plugins/contextMenu/contextMenu.mjs +1 -1
- package/shortcuts/utils.js +8 -1
- package/shortcuts/utils.mjs +8 -1
package/focusManager.js
CHANGED
@@ -4,6 +4,7 @@ exports.__esModule = true;
|
|
4
4
|
require("core-js/modules/es.error.cause.js");
|
5
5
|
var _console = require("./helpers/console");
|
6
6
|
var _element = require("./helpers/dom/element");
|
7
|
+
var _function = require("./helpers/function");
|
7
8
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
8
9
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
9
10
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
@@ -33,8 +34,10 @@ var _hot = /*#__PURE__*/new WeakMap();
|
|
33
34
|
var _focusMode = /*#__PURE__*/new WeakMap();
|
34
35
|
var _refocusDelay = /*#__PURE__*/new WeakMap();
|
35
36
|
var _refocusElementGetter = /*#__PURE__*/new WeakMap();
|
37
|
+
var _debouncedSelect = /*#__PURE__*/new WeakMap();
|
36
38
|
var _getSelectedCell = /*#__PURE__*/new WeakSet();
|
37
|
-
var
|
39
|
+
var _focusCell = /*#__PURE__*/new WeakSet();
|
40
|
+
var _focusEditorElement = /*#__PURE__*/new WeakSet();
|
38
41
|
var _onUpdateSettings = /*#__PURE__*/new WeakSet();
|
39
42
|
class FocusManager {
|
40
43
|
constructor(hotInstance) {
|
@@ -42,21 +45,21 @@ class FocusManager {
|
|
42
45
|
/**
|
43
46
|
* Update the manager configuration after calling `updateSettings`.
|
44
47
|
*
|
45
|
-
* @private
|
46
48
|
* @param {object} newSettings The new settings passed to the `updateSettings` method.
|
47
49
|
*/
|
48
50
|
_classPrivateMethodInitSpec(this, _onUpdateSettings);
|
49
51
|
/**
|
50
|
-
* Manage the browser's focus after cell selection.
|
51
|
-
|
52
|
-
|
52
|
+
* Manage the browser's focus after cell selection end.
|
53
|
+
*/
|
54
|
+
_classPrivateMethodInitSpec(this, _focusEditorElement);
|
55
|
+
/**
|
56
|
+
* Manage the browser's focus after each cell selection change.
|
53
57
|
*/
|
54
|
-
_classPrivateMethodInitSpec(this,
|
58
|
+
_classPrivateMethodInitSpec(this, _focusCell);
|
55
59
|
/**
|
56
60
|
* Get and return the currently selected and highlighted cell/header element.
|
57
61
|
*
|
58
|
-
* @
|
59
|
-
* @param {Function} [callback] Callback function to be called after the cell element is retrieved.
|
62
|
+
* @param {Function} callback Callback function to be called after the cell element is retrieved.
|
60
63
|
*/
|
61
64
|
_classPrivateMethodInitSpec(this, _getSelectedCell);
|
62
65
|
/**
|
@@ -74,7 +77,7 @@ class FocusManager {
|
|
74
77
|
* - 'mixed' - The browser's focus switches from the lastly selected cell element to the currently active editor's
|
75
78
|
* `TEXTAREA` element after a delay defined in the manager.
|
76
79
|
*
|
77
|
-
* @type {
|
80
|
+
* @type {'cell' | 'mixed'}
|
78
81
|
*/
|
79
82
|
_classPrivateFieldInitSpec(this, _focusMode, {
|
80
83
|
writable: true,
|
@@ -100,6 +103,15 @@ class FocusManager {
|
|
100
103
|
writable: true,
|
101
104
|
value: null
|
102
105
|
});
|
106
|
+
/**
|
107
|
+
* Map of the debounced `select` functions.
|
108
|
+
*
|
109
|
+
* @type {Map<number, Function>}
|
110
|
+
*/
|
111
|
+
_classPrivateFieldInitSpec(this, _debouncedSelect, {
|
112
|
+
writable: true,
|
113
|
+
value: new Map()
|
114
|
+
});
|
103
115
|
const hotSettings = hotInstance.getSettings();
|
104
116
|
_classPrivateFieldSet(this, _hot, hotInstance);
|
105
117
|
_classPrivateFieldSet(this, _focusMode, hotSettings.imeFastEdit ? FOCUS_MODES.MIXED : FOCUS_MODES.CELL);
|
@@ -113,7 +125,13 @@ class FocusManager {
|
|
113
125
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
114
126
|
args[_key2] = arguments[_key2];
|
115
127
|
}
|
116
|
-
return _classPrivateMethodGet(_this,
|
128
|
+
return _classPrivateMethodGet(_this, _focusCell, _focusCell2).call(_this, ...args);
|
129
|
+
});
|
130
|
+
_classPrivateFieldGet(this, _hot).addHook('afterSelectionEnd', function () {
|
131
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
132
|
+
args[_key3] = arguments[_key3];
|
133
|
+
}
|
134
|
+
return _classPrivateMethodGet(_this, _focusEditorElement, _focusEditorElement2).call(_this, ...args);
|
117
135
|
});
|
118
136
|
}
|
119
137
|
|
@@ -215,7 +233,7 @@ class FocusManager {
|
|
215
233
|
* Set the focus to the active editor's `TEXTAREA` element after the provided delay. If no delay is provided, it
|
216
234
|
* will be taken from the manager's configuration.
|
217
235
|
*
|
218
|
-
* @param {number} delay Delay in milliseconds.
|
236
|
+
* @param {number} [delay] Delay in milliseconds.
|
219
237
|
*/
|
220
238
|
refocusToEditorTextarea() {
|
221
239
|
var _classPrivateFieldGet5;
|
@@ -224,19 +242,21 @@ class FocusManager {
|
|
224
242
|
|
225
243
|
// Re-focus on the editor's `TEXTAREA` element (or a predefined element) if the `imeFastEdit` option is enabled.
|
226
244
|
if (_classPrivateFieldGet(this, _hot).getSettings().imeFastEdit && !((_classPrivateFieldGet5 = _classPrivateFieldGet(this, _hot).getActiveEditor()) !== null && _classPrivateFieldGet5 !== void 0 && _classPrivateFieldGet5.isOpened()) && !!refocusElement) {
|
227
|
-
_classPrivateFieldGet(this,
|
228
|
-
|
229
|
-
|
245
|
+
if (!_classPrivateFieldGet(this, _debouncedSelect).has(delay)) {
|
246
|
+
_classPrivateFieldGet(this, _debouncedSelect).set(delay, (0, _function.debounce)(() => {
|
247
|
+
refocusElement.select();
|
248
|
+
}, delay));
|
249
|
+
}
|
250
|
+
_classPrivateFieldGet(this, _debouncedSelect).get(delay)();
|
230
251
|
}
|
231
252
|
}
|
232
253
|
}
|
233
254
|
exports.FocusManager = FocusManager;
|
234
|
-
function _getSelectedCell2() {
|
255
|
+
function _getSelectedCell2(callback) {
|
235
256
|
var _classPrivateFieldGet6;
|
236
|
-
let callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : () => {};
|
237
257
|
const highlight = (_classPrivateFieldGet6 = _classPrivateFieldGet(this, _hot).getSelectedRangeLast()) === null || _classPrivateFieldGet6 === void 0 ? void 0 : _classPrivateFieldGet6.highlight;
|
238
258
|
if (!highlight) {
|
239
|
-
|
259
|
+
callback(null);
|
240
260
|
return;
|
241
261
|
}
|
242
262
|
const cell = _classPrivateFieldGet(this, _hot).getCell(highlight.row, highlight.col, true);
|
@@ -248,7 +268,7 @@ function _getSelectedCell2() {
|
|
248
268
|
callback(cell);
|
249
269
|
}
|
250
270
|
}
|
251
|
-
function
|
271
|
+
function _focusCell2() {
|
252
272
|
_classPrivateMethodGet(this, _getSelectedCell, _getSelectedCell2).call(this, selectedCell => {
|
253
273
|
const {
|
254
274
|
activeElement
|
@@ -262,10 +282,12 @@ function _manageFocus2() {
|
|
262
282
|
activeElement.blur();
|
263
283
|
}
|
264
284
|
this.focusOnHighlightedCell(selectedCell);
|
285
|
+
});
|
286
|
+
}
|
287
|
+
function _focusEditorElement2() {
|
288
|
+
_classPrivateMethodGet(this, _getSelectedCell, _getSelectedCell2).call(this, selectedCell => {
|
265
289
|
if (this.getFocusMode() === FOCUS_MODES.MIXED && selectedCell.nodeName === 'TD') {
|
266
|
-
|
267
|
-
this.refocusToEditorTextarea();
|
268
|
-
});
|
290
|
+
this.refocusToEditorTextarea();
|
269
291
|
}
|
270
292
|
});
|
271
293
|
}
|
package/focusManager.mjs
CHANGED
@@ -10,6 +10,7 @@ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!priva
|
|
10
10
|
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
11
11
|
import { warn } from "./helpers/console.mjs";
|
12
12
|
import { isOutsideInput } from "./helpers/dom/element.mjs";
|
13
|
+
import { debounce } from "./helpers/function.mjs";
|
13
14
|
/**
|
14
15
|
* Possible focus modes.
|
15
16
|
* - CELL - The browser's focus stays on the lastly selected cell element.
|
@@ -30,8 +31,10 @@ var _hot = /*#__PURE__*/new WeakMap();
|
|
30
31
|
var _focusMode = /*#__PURE__*/new WeakMap();
|
31
32
|
var _refocusDelay = /*#__PURE__*/new WeakMap();
|
32
33
|
var _refocusElementGetter = /*#__PURE__*/new WeakMap();
|
34
|
+
var _debouncedSelect = /*#__PURE__*/new WeakMap();
|
33
35
|
var _getSelectedCell = /*#__PURE__*/new WeakSet();
|
34
|
-
var
|
36
|
+
var _focusCell = /*#__PURE__*/new WeakSet();
|
37
|
+
var _focusEditorElement = /*#__PURE__*/new WeakSet();
|
35
38
|
var _onUpdateSettings = /*#__PURE__*/new WeakSet();
|
36
39
|
export class FocusManager {
|
37
40
|
constructor(hotInstance) {
|
@@ -39,21 +42,21 @@ export class FocusManager {
|
|
39
42
|
/**
|
40
43
|
* Update the manager configuration after calling `updateSettings`.
|
41
44
|
*
|
42
|
-
* @private
|
43
45
|
* @param {object} newSettings The new settings passed to the `updateSettings` method.
|
44
46
|
*/
|
45
47
|
_classPrivateMethodInitSpec(this, _onUpdateSettings);
|
46
48
|
/**
|
47
|
-
* Manage the browser's focus after cell selection.
|
48
|
-
|
49
|
-
|
49
|
+
* Manage the browser's focus after cell selection end.
|
50
|
+
*/
|
51
|
+
_classPrivateMethodInitSpec(this, _focusEditorElement);
|
52
|
+
/**
|
53
|
+
* Manage the browser's focus after each cell selection change.
|
50
54
|
*/
|
51
|
-
_classPrivateMethodInitSpec(this,
|
55
|
+
_classPrivateMethodInitSpec(this, _focusCell);
|
52
56
|
/**
|
53
57
|
* Get and return the currently selected and highlighted cell/header element.
|
54
58
|
*
|
55
|
-
* @
|
56
|
-
* @param {Function} [callback] Callback function to be called after the cell element is retrieved.
|
59
|
+
* @param {Function} callback Callback function to be called after the cell element is retrieved.
|
57
60
|
*/
|
58
61
|
_classPrivateMethodInitSpec(this, _getSelectedCell);
|
59
62
|
/**
|
@@ -71,7 +74,7 @@ export class FocusManager {
|
|
71
74
|
* - 'mixed' - The browser's focus switches from the lastly selected cell element to the currently active editor's
|
72
75
|
* `TEXTAREA` element after a delay defined in the manager.
|
73
76
|
*
|
74
|
-
* @type {
|
77
|
+
* @type {'cell' | 'mixed'}
|
75
78
|
*/
|
76
79
|
_classPrivateFieldInitSpec(this, _focusMode, {
|
77
80
|
writable: true,
|
@@ -97,6 +100,15 @@ export class FocusManager {
|
|
97
100
|
writable: true,
|
98
101
|
value: null
|
99
102
|
});
|
103
|
+
/**
|
104
|
+
* Map of the debounced `select` functions.
|
105
|
+
*
|
106
|
+
* @type {Map<number, Function>}
|
107
|
+
*/
|
108
|
+
_classPrivateFieldInitSpec(this, _debouncedSelect, {
|
109
|
+
writable: true,
|
110
|
+
value: new Map()
|
111
|
+
});
|
100
112
|
const hotSettings = hotInstance.getSettings();
|
101
113
|
_classPrivateFieldSet(this, _hot, hotInstance);
|
102
114
|
_classPrivateFieldSet(this, _focusMode, hotSettings.imeFastEdit ? FOCUS_MODES.MIXED : FOCUS_MODES.CELL);
|
@@ -110,7 +122,13 @@ export class FocusManager {
|
|
110
122
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
111
123
|
args[_key2] = arguments[_key2];
|
112
124
|
}
|
113
|
-
return _classPrivateMethodGet(_this,
|
125
|
+
return _classPrivateMethodGet(_this, _focusCell, _focusCell2).call(_this, ...args);
|
126
|
+
});
|
127
|
+
_classPrivateFieldGet(this, _hot).addHook('afterSelectionEnd', function () {
|
128
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
129
|
+
args[_key3] = arguments[_key3];
|
130
|
+
}
|
131
|
+
return _classPrivateMethodGet(_this, _focusEditorElement, _focusEditorElement2).call(_this, ...args);
|
114
132
|
});
|
115
133
|
}
|
116
134
|
|
@@ -212,7 +230,7 @@ export class FocusManager {
|
|
212
230
|
* Set the focus to the active editor's `TEXTAREA` element after the provided delay. If no delay is provided, it
|
213
231
|
* will be taken from the manager's configuration.
|
214
232
|
*
|
215
|
-
* @param {number} delay Delay in milliseconds.
|
233
|
+
* @param {number} [delay] Delay in milliseconds.
|
216
234
|
*/
|
217
235
|
refocusToEditorTextarea() {
|
218
236
|
var _classPrivateFieldGet5;
|
@@ -221,18 +239,20 @@ export class FocusManager {
|
|
221
239
|
|
222
240
|
// Re-focus on the editor's `TEXTAREA` element (or a predefined element) if the `imeFastEdit` option is enabled.
|
223
241
|
if (_classPrivateFieldGet(this, _hot).getSettings().imeFastEdit && !((_classPrivateFieldGet5 = _classPrivateFieldGet(this, _hot).getActiveEditor()) !== null && _classPrivateFieldGet5 !== void 0 && _classPrivateFieldGet5.isOpened()) && !!refocusElement) {
|
224
|
-
_classPrivateFieldGet(this,
|
225
|
-
|
226
|
-
|
242
|
+
if (!_classPrivateFieldGet(this, _debouncedSelect).has(delay)) {
|
243
|
+
_classPrivateFieldGet(this, _debouncedSelect).set(delay, debounce(() => {
|
244
|
+
refocusElement.select();
|
245
|
+
}, delay));
|
246
|
+
}
|
247
|
+
_classPrivateFieldGet(this, _debouncedSelect).get(delay)();
|
227
248
|
}
|
228
249
|
}
|
229
250
|
}
|
230
|
-
function _getSelectedCell2() {
|
251
|
+
function _getSelectedCell2(callback) {
|
231
252
|
var _classPrivateFieldGet6;
|
232
|
-
let callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : () => {};
|
233
253
|
const highlight = (_classPrivateFieldGet6 = _classPrivateFieldGet(this, _hot).getSelectedRangeLast()) === null || _classPrivateFieldGet6 === void 0 ? void 0 : _classPrivateFieldGet6.highlight;
|
234
254
|
if (!highlight) {
|
235
|
-
|
255
|
+
callback(null);
|
236
256
|
return;
|
237
257
|
}
|
238
258
|
const cell = _classPrivateFieldGet(this, _hot).getCell(highlight.row, highlight.col, true);
|
@@ -244,7 +264,7 @@ function _getSelectedCell2() {
|
|
244
264
|
callback(cell);
|
245
265
|
}
|
246
266
|
}
|
247
|
-
function
|
267
|
+
function _focusCell2() {
|
248
268
|
_classPrivateMethodGet(this, _getSelectedCell, _getSelectedCell2).call(this, selectedCell => {
|
249
269
|
const {
|
250
270
|
activeElement
|
@@ -258,10 +278,12 @@ function _manageFocus2() {
|
|
258
278
|
activeElement.blur();
|
259
279
|
}
|
260
280
|
this.focusOnHighlightedCell(selectedCell);
|
281
|
+
});
|
282
|
+
}
|
283
|
+
function _focusEditorElement2() {
|
284
|
+
_classPrivateMethodGet(this, _getSelectedCell, _getSelectedCell2).call(this, selectedCell => {
|
261
285
|
if (this.getFocusMode() === FOCUS_MODES.MIXED && selectedCell.nodeName === 'TD') {
|
262
|
-
|
263
|
-
this.refocusToEditorTextarea();
|
264
|
-
});
|
286
|
+
this.refocusToEditorTextarea();
|
265
287
|
}
|
266
288
|
});
|
267
289
|
}
|
package/helpers/mixed.js
CHANGED
@@ -134,7 +134,7 @@ const domMessages = {
|
|
134
134
|
function _injectProductInfo(key, element) {
|
135
135
|
const hasValidType = !isEmpty(key);
|
136
136
|
const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
137
|
-
const hotVersion = "0.0.0-next-
|
137
|
+
const hotVersion = "0.0.0-next-1aba9db-20231128";
|
138
138
|
let keyValidityDate;
|
139
139
|
let consoleMessageState = 'invalid';
|
140
140
|
let domMessageState = 'invalid';
|
package/helpers/mixed.mjs
CHANGED
@@ -124,7 +124,7 @@ const domMessages = {
|
|
124
124
|
export function _injectProductInfo(key, element) {
|
125
125
|
const hasValidType = !isEmpty(key);
|
126
126
|
const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
127
|
-
const hotVersion = "0.0.0-next-
|
127
|
+
const hotVersion = "0.0.0-next-1aba9db-20231128";
|
128
128
|
let keyValidityDate;
|
129
129
|
let consoleMessageState = 'invalid';
|
130
130
|
let domMessageState = 'invalid';
|
package/package.json
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
"url": "https://github.com/handsontable/handsontable/issues"
|
11
11
|
},
|
12
12
|
"author": "Handsoncode <hello@handsontable.com>",
|
13
|
-
"version": "0.0.0-next-
|
13
|
+
"version": "0.0.0-next-1aba9db-20231128",
|
14
14
|
"main": "index",
|
15
15
|
"module": "index.mjs",
|
16
16
|
"jsnext:main": "index.mjs",
|
@@ -192,7 +192,7 @@ class ContextMenu extends _base.BasePlugin {
|
|
192
192
|
*/
|
193
193
|
registerShortcuts() {
|
194
194
|
this.hot.getShortcutManager().getContext('grid').addShortcut({
|
195
|
-
keys: [['Control/Meta', 'Shift', '
|
195
|
+
keys: [['Control/Meta', 'Shift', 'Backslash'], ['Shift', 'F10']],
|
196
196
|
callback: () => {
|
197
197
|
const {
|
198
198
|
highlight
|
@@ -186,7 +186,7 @@ export class ContextMenu extends BasePlugin {
|
|
186
186
|
*/
|
187
187
|
registerShortcuts() {
|
188
188
|
this.hot.getShortcutManager().getContext('grid').addShortcut({
|
189
|
-
keys: [['Control/Meta', 'Shift', '
|
189
|
+
keys: [['Control/Meta', 'Shift', 'Backslash'], ['Shift', 'F10']],
|
190
190
|
callback: () => {
|
191
191
|
const {
|
192
192
|
highlight
|
package/shortcuts/utils.js
CHANGED
@@ -42,6 +42,7 @@ const getKeysList = normalizedKeys => {
|
|
42
42
|
*/
|
43
43
|
exports.getKeysList = getKeysList;
|
44
44
|
const codeToKeyRegExp = new RegExp('^(?:Key|Digit)([A-Z0-9])$');
|
45
|
+
const keyCodeNames = new Set(['Backquote', 'Minus', 'Equal', 'BracketLeft', 'BracketRight', 'Backslash', 'Semicolon', 'Quote', 'Comma', 'Period', 'Slash']);
|
45
46
|
|
46
47
|
/**
|
47
48
|
* Normalizes a keyboard event key value to a key before its modification. When the keyboard event
|
@@ -58,6 +59,12 @@ const normalizeEventKey = _ref => {
|
|
58
59
|
key,
|
59
60
|
code
|
60
61
|
} = _ref;
|
61
|
-
|
62
|
+
let normalizedKey = key;
|
63
|
+
if (codeToKeyRegExp.test(code)) {
|
64
|
+
normalizedKey = code.replace(codeToKeyRegExp, '$1');
|
65
|
+
} else if (keyCodeNames.has(code)) {
|
66
|
+
normalizedKey = code;
|
67
|
+
}
|
68
|
+
return normalizedKey.toLowerCase();
|
62
69
|
};
|
63
70
|
exports.normalizeEventKey = normalizeEventKey;
|
package/shortcuts/utils.mjs
CHANGED
@@ -37,6 +37,7 @@ export const getKeysList = normalizedKeys => {
|
|
37
37
|
* the string.
|
38
38
|
*/
|
39
39
|
const codeToKeyRegExp = new RegExp('^(?:Key|Digit)([A-Z0-9])$');
|
40
|
+
const keyCodeNames = new Set(['Backquote', 'Minus', 'Equal', 'BracketLeft', 'BracketRight', 'Backslash', 'Semicolon', 'Quote', 'Comma', 'Period', 'Slash']);
|
40
41
|
|
41
42
|
/**
|
42
43
|
* Normalizes a keyboard event key value to a key before its modification. When the keyboard event
|
@@ -53,5 +54,11 @@ export const normalizeEventKey = _ref => {
|
|
53
54
|
key,
|
54
55
|
code
|
55
56
|
} = _ref;
|
56
|
-
|
57
|
+
let normalizedKey = key;
|
58
|
+
if (codeToKeyRegExp.test(code)) {
|
59
|
+
normalizedKey = code.replace(codeToKeyRegExp, '$1');
|
60
|
+
} else if (keyCodeNames.has(code)) {
|
61
|
+
normalizedKey = code;
|
62
|
+
}
|
63
|
+
return normalizedKey.toLowerCase();
|
57
64
|
};
|