tiny-markdown-editor 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/tiny-mde.css +2 -6
- package/dist/tiny-mde.js +3029 -5066
- package/dist/tiny-mde.min.css +1 -1
- package/dist/tiny-mde.min.js +1 -1
- package/dist/tiny-mde.tiny.js +1 -1
- package/lib/TinyMDE.js +1423 -1850
- package/lib/TinyMDECommandBar.js +144 -301
- package/lib/grammar.js +91 -155
- package/lib/index.js +2 -5
- package/lib/svg/svg.js +15 -16
- package/lib/tiny.js +1 -3
- package/package.json +18 -18
package/lib/TinyMDECommandBar.js
CHANGED
|
@@ -1,70 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.symbol");
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.symbol.description");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.symbol.iterator");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.array.concat");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/es.array.from");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/es.array.iterator");
|
|
14
|
-
|
|
15
|
-
require("core-js/modules/es.array.join");
|
|
16
|
-
|
|
17
|
-
require("core-js/modules/es.array.slice");
|
|
18
|
-
|
|
19
|
-
require("core-js/modules/es.function.name");
|
|
20
|
-
|
|
21
|
-
require("core-js/modules/es.object.assign");
|
|
22
|
-
|
|
23
|
-
require("core-js/modules/es.object.to-string");
|
|
24
|
-
|
|
25
|
-
require("core-js/modules/es.regexp.exec");
|
|
26
|
-
|
|
27
|
-
require("core-js/modules/es.regexp.to-string");
|
|
28
|
-
|
|
29
|
-
require("core-js/modules/es.string.iterator");
|
|
30
|
-
|
|
31
|
-
require("core-js/modules/es.string.match");
|
|
32
|
-
|
|
33
|
-
require("core-js/modules/es.string.split");
|
|
34
|
-
|
|
35
|
-
require("core-js/modules/es.string.anchor");
|
|
36
|
-
|
|
37
|
-
require("core-js/modules/es.string.bold");
|
|
38
|
-
|
|
39
|
-
require("core-js/modules/es.string.link");
|
|
40
|
-
|
|
41
|
-
require("core-js/modules/web.dom-collections.iterator");
|
|
42
|
-
|
|
43
3
|
Object.defineProperty(exports, "__esModule", {
|
|
44
4
|
value: true
|
|
45
5
|
});
|
|
46
6
|
exports.default = void 0;
|
|
47
|
-
|
|
48
7
|
var _svg = _interopRequireDefault(require("./svg/svg"));
|
|
49
|
-
|
|
50
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
55
|
-
|
|
56
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
57
|
-
|
|
58
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
59
|
-
|
|
60
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
61
|
-
|
|
62
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
63
|
-
|
|
64
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
65
|
-
|
|
66
|
-
var isMacLike = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
|
|
67
|
-
var DefaultCommands = {
|
|
9
|
+
const isMacLike = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
|
|
10
|
+
const DefaultCommands = {
|
|
68
11
|
'bold': {
|
|
69
12
|
name: 'bold',
|
|
70
13
|
action: 'bold',
|
|
@@ -127,296 +70,196 @@ var DefaultCommands = {
|
|
|
127
70
|
},
|
|
128
71
|
'insertLink': {
|
|
129
72
|
name: 'insertLink',
|
|
130
|
-
action:
|
|
73
|
+
action: editor => {
|
|
131
74
|
if (editor.isInlineFormattingAllowed()) editor.wrapSelection('[', ']()');
|
|
132
75
|
},
|
|
133
|
-
enabled:
|
|
134
|
-
return editor.isInlineFormattingAllowed(focus, anchor) ? false : null;
|
|
135
|
-
},
|
|
76
|
+
enabled: (editor, focus, anchor) => editor.isInlineFormattingAllowed(focus, anchor) ? false : null,
|
|
136
77
|
innerHTML: _svg.default.link,
|
|
137
78
|
title: 'Insert link',
|
|
138
79
|
hotkey: 'Mod-K'
|
|
139
80
|
},
|
|
140
81
|
'insertImage': {
|
|
141
82
|
name: 'insertImage',
|
|
142
|
-
action:
|
|
83
|
+
action: editor => {
|
|
143
84
|
if (editor.isInlineFormattingAllowed()) editor.wrapSelection('![', ']()');
|
|
144
85
|
},
|
|
145
|
-
enabled:
|
|
146
|
-
return editor.isInlineFormattingAllowed(focus, anchor) ? false : null;
|
|
147
|
-
},
|
|
86
|
+
enabled: (editor, focus, anchor) => editor.isInlineFormattingAllowed(focus, anchor) ? false : null,
|
|
148
87
|
innerHTML: _svg.default.image,
|
|
149
88
|
title: 'Insert image',
|
|
150
89
|
hotkey: 'Mod2-Shift-I'
|
|
151
90
|
},
|
|
152
91
|
'hr': {
|
|
153
92
|
name: 'hr',
|
|
154
|
-
action:
|
|
155
|
-
|
|
156
|
-
},
|
|
157
|
-
enabled: function enabled() {
|
|
158
|
-
return false;
|
|
159
|
-
},
|
|
93
|
+
action: editor => editor.paste('\n***\n'),
|
|
94
|
+
enabled: () => false,
|
|
160
95
|
innerHTML: _svg.default.hr,
|
|
161
96
|
title: 'Insert horizontal line',
|
|
162
97
|
hotkey: 'Mod2-Shift-L'
|
|
163
98
|
}
|
|
164
99
|
};
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
function CommandBar(props) {
|
|
168
|
-
var _this = this;
|
|
169
|
-
|
|
170
|
-
_classCallCheck(this, CommandBar);
|
|
171
|
-
|
|
100
|
+
class CommandBar {
|
|
101
|
+
constructor(props) {
|
|
172
102
|
this.e = null;
|
|
173
103
|
this.editor = null;
|
|
174
104
|
this.commands = [];
|
|
175
105
|
this.buttons = {};
|
|
176
106
|
this.state = {};
|
|
177
107
|
this.hotkeys = [];
|
|
178
|
-
|
|
179
|
-
|
|
108
|
+
let element = props.element;
|
|
180
109
|
if (element && !element.tagName) {
|
|
181
110
|
element = document.getElementById(props.element);
|
|
182
111
|
}
|
|
183
|
-
|
|
184
112
|
if (!element) {
|
|
185
113
|
element = document.body;
|
|
186
114
|
}
|
|
187
|
-
|
|
188
115
|
this.createCommandBarElement(element, props.commands || ['bold', 'italic', 'strikethrough', '|', 'code', '|', 'h1', 'h2', '|', 'ul', 'ol', '|', 'blockquote', 'hr', '|', 'insertLink', 'insertImage']);
|
|
189
|
-
document.addEventListener('keydown',
|
|
190
|
-
return _this.handleKeydown(e);
|
|
191
|
-
});
|
|
116
|
+
document.addEventListener('keydown', e => this.handleKeydown(e));
|
|
192
117
|
if (props.editor) this.setEditor(props.editor);
|
|
193
118
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
if (command == '|') {
|
|
211
|
-
var el = document.createElement('div');
|
|
212
|
-
el.className = 'TMCommandDivider';
|
|
213
|
-
this.e.appendChild(el);
|
|
119
|
+
createCommandBarElement(parentElement, commands) {
|
|
120
|
+
this.e = document.createElement('div');
|
|
121
|
+
this.e.className = 'TMCommandBar';
|
|
122
|
+
for (let command of commands) {
|
|
123
|
+
if (command == '|') {
|
|
124
|
+
let el = document.createElement('div');
|
|
125
|
+
el.className = 'TMCommandDivider';
|
|
126
|
+
this.e.appendChild(el);
|
|
127
|
+
} else {
|
|
128
|
+
let commandName;
|
|
129
|
+
if (typeof command == "string") {
|
|
130
|
+
// Reference to default command
|
|
131
|
+
|
|
132
|
+
if (DefaultCommands[command]) {
|
|
133
|
+
commandName = command;
|
|
134
|
+
this.commands[commandName] = DefaultCommands[commandName];
|
|
214
135
|
} else {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
modifiers.push('altKey');
|
|
263
|
-
modifierexplanation.push('⌥');
|
|
264
|
-
break;
|
|
265
|
-
|
|
266
|
-
case 'Win':
|
|
267
|
-
modifiers.push('metaKey');
|
|
268
|
-
modifierexplanation.push('⊞ Win');
|
|
269
|
-
break;
|
|
270
|
-
|
|
271
|
-
case 'Shift':
|
|
272
|
-
modifiers.push('shiftKey');
|
|
273
|
-
modifierexplanation.push('⇧');
|
|
274
|
-
break;
|
|
275
|
-
|
|
276
|
-
case 'Mod':
|
|
277
|
-
// Mod is a convenience mechanism: Ctrl on Windows, Cmd on Mac
|
|
278
|
-
if (isMacLike) {
|
|
279
|
-
modifiers.push('metaKey');
|
|
280
|
-
modifierexplanation.push('⌘');
|
|
281
|
-
} else {
|
|
282
|
-
modifiers.push('ctrlKey');
|
|
283
|
-
modifierexplanation.push('Ctrl');
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
break;
|
|
287
|
-
|
|
288
|
-
case 'Mod2':
|
|
289
|
-
modifiers.push('altKey');
|
|
290
|
-
if (isMacLike) modifierexplanation.push('⌥');else modifierexplanation.push('Alt');
|
|
291
|
-
break;
|
|
292
|
-
// Mod2 is a convenience mechanism: Alt on Windows, Option on Mac
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
modifierexplanation.push(keys[keys.length - 1]);
|
|
297
|
-
var hotkey = {
|
|
298
|
-
modifiers: modifiers,
|
|
299
|
-
command: commandName
|
|
300
|
-
}; // TODO Right now this is working only for letters and numbers
|
|
301
|
-
|
|
302
|
-
if (keys[keys.length - 1].match(/^[0-9]$/)) {
|
|
303
|
-
hotkey.code = "Digit".concat(keys[keys.length - 1]);
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
} else if (typeof command == "object" && command.name) {
|
|
139
|
+
commandName = command.name;
|
|
140
|
+
this.commands[commandName] = {};
|
|
141
|
+
if (DefaultCommands[commandName]) Object.assign(this.commands[commandName], DefaultCommands[commandName]);
|
|
142
|
+
Object.assign(this.commands[commandName], command);
|
|
143
|
+
} else {
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
let title = this.commands[commandName].title || commandName;
|
|
147
|
+
if (this.commands[commandName].hotkey) {
|
|
148
|
+
const keys = this.commands[commandName].hotkey.split('-');
|
|
149
|
+
// construct modifiers
|
|
150
|
+
let modifiers = [];
|
|
151
|
+
let modifierexplanation = [];
|
|
152
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
153
|
+
switch (keys[i]) {
|
|
154
|
+
case 'Ctrl':
|
|
155
|
+
modifiers.push('ctrlKey');
|
|
156
|
+
modifierexplanation.push('Ctrl');
|
|
157
|
+
break;
|
|
158
|
+
case 'Cmd':
|
|
159
|
+
modifiers.push('metaKey');
|
|
160
|
+
modifierexplanation.push('⌘');
|
|
161
|
+
break;
|
|
162
|
+
case 'Alt':
|
|
163
|
+
modifiers.push('altKey');
|
|
164
|
+
modifierexplanation.push('Alt');
|
|
165
|
+
break;
|
|
166
|
+
case 'Option':
|
|
167
|
+
modifiers.push('altKey');
|
|
168
|
+
modifierexplanation.push('⌥');
|
|
169
|
+
break;
|
|
170
|
+
case 'Win':
|
|
171
|
+
modifiers.push('metaKey');
|
|
172
|
+
modifierexplanation.push('⊞ Win');
|
|
173
|
+
break;
|
|
174
|
+
case 'Shift':
|
|
175
|
+
modifiers.push('shiftKey');
|
|
176
|
+
modifierexplanation.push('⇧');
|
|
177
|
+
break;
|
|
178
|
+
case 'Mod':
|
|
179
|
+
// Mod is a convenience mechanism: Ctrl on Windows, Cmd on Mac
|
|
180
|
+
if (isMacLike) {
|
|
181
|
+
modifiers.push('metaKey');
|
|
182
|
+
modifierexplanation.push('⌘');
|
|
304
183
|
} else {
|
|
305
|
-
|
|
184
|
+
modifiers.push('ctrlKey');
|
|
185
|
+
modifierexplanation.push('Ctrl');
|
|
306
186
|
}
|
|
187
|
+
break;
|
|
188
|
+
case 'Mod2':
|
|
189
|
+
modifiers.push('altKey');
|
|
190
|
+
if (isMacLike) modifierexplanation.push('⌥');else modifierexplanation.push('Alt');
|
|
191
|
+
break;
|
|
192
|
+
// Mod2 is a convenience mechanism: Alt on Windows, Option on Mac
|
|
193
|
+
}
|
|
194
|
+
}
|
|
307
195
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
_this2.buttons[commandName].addEventListener('mousedown', function (e) {
|
|
319
|
-
return _this2.handleClick(commandName, e);
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
_this2.e.appendChild(_this2.buttons[commandName]);
|
|
323
|
-
}();
|
|
324
|
-
|
|
325
|
-
if (_ret === "continue") continue;
|
|
196
|
+
modifierexplanation.push(keys[keys.length - 1]);
|
|
197
|
+
let hotkey = {
|
|
198
|
+
modifiers: modifiers,
|
|
199
|
+
command: commandName
|
|
200
|
+
};
|
|
201
|
+
// TODO Right now this is working only for letters and numbers
|
|
202
|
+
if (keys[keys.length - 1].match(/^[0-9]$/)) {
|
|
203
|
+
hotkey.code = `Digit${keys[keys.length - 1]}`;
|
|
204
|
+
} else {
|
|
205
|
+
hotkey.key = keys[keys.length - 1].toLowerCase();
|
|
326
206
|
}
|
|
207
|
+
this.hotkeys.push(hotkey);
|
|
208
|
+
title = title.concat(` (${modifierexplanation.join('+')})`);
|
|
327
209
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
210
|
+
this.buttons[commandName] = document.createElement('div');
|
|
211
|
+
this.buttons[commandName].className = 'TMCommandButton TMCommandButton_Disabled';
|
|
212
|
+
this.buttons[commandName].title = title;
|
|
213
|
+
this.buttons[commandName].innerHTML = this.commands[commandName].innerHTML;
|
|
214
|
+
this.buttons[commandName].addEventListener('mousedown', e => this.handleClick(commandName, e));
|
|
215
|
+
this.e.appendChild(this.buttons[commandName]);
|
|
332
216
|
}
|
|
333
|
-
|
|
334
|
-
parentElement.appendChild(this.e);
|
|
335
217
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
if (
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
this.commands[commandName].action(this.editor);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}, {
|
|
349
|
-
key: "setEditor",
|
|
350
|
-
value: function setEditor(editor) {
|
|
351
|
-
var _this3 = this;
|
|
352
|
-
|
|
353
|
-
this.editor = editor;
|
|
354
|
-
editor.addEventListener('selection', function (e) {
|
|
355
|
-
return _this3.handleSelection(e);
|
|
356
|
-
});
|
|
218
|
+
parentElement.appendChild(this.e);
|
|
219
|
+
}
|
|
220
|
+
handleClick(commandName, event) {
|
|
221
|
+
if (!this.editor) return;
|
|
222
|
+
event.preventDefault();
|
|
223
|
+
if (typeof this.commands[commandName].action == "string") {
|
|
224
|
+
if (this.state[commandName] === false) this.editor.setCommandState(commandName, true);else this.editor.setCommandState(commandName, false);
|
|
225
|
+
} else if (typeof this.commands[commandName].action == "function") {
|
|
226
|
+
this.commands[commandName].action(this.editor);
|
|
357
227
|
}
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
228
|
+
}
|
|
229
|
+
setEditor(editor) {
|
|
230
|
+
this.editor = editor;
|
|
231
|
+
editor.addEventListener('selection', e => this.handleSelection(e));
|
|
232
|
+
}
|
|
233
|
+
handleSelection(event) {
|
|
234
|
+
if (event.commandState) {
|
|
235
|
+
for (let command in this.commands) {
|
|
236
|
+
if (event.commandState[command] === undefined) {
|
|
237
|
+
if (this.commands[command].enabled) this.state[command] = this.commands[command].enabled(this.editor, event.focus, event.anchor);else this.state[command] = event.focus ? false : null;
|
|
238
|
+
} else {
|
|
239
|
+
this.state[command] = event.commandState[command];
|
|
240
|
+
}
|
|
241
|
+
if (this.state[command] === true) {
|
|
242
|
+
this.buttons[command].className = 'TMCommandButton TMCommandButton_Active';
|
|
243
|
+
} else if (this.state[command] === false) {
|
|
244
|
+
this.buttons[command].className = 'TMCommandButton TMCommandButton_Inactive';
|
|
245
|
+
} else {
|
|
246
|
+
this.buttons[command].className = 'TMCommandButton TMCommandButton_Disabled';
|
|
376
247
|
}
|
|
377
248
|
}
|
|
378
249
|
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
outer: for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
387
|
-
var hotkey = _step2.value;
|
|
388
|
-
|
|
389
|
-
if (hotkey.key && event.key.toLowerCase() == hotkey.key || hotkey.code && event.code == hotkey.code) {
|
|
390
|
-
// Key matches hotkey. Look for any required modifier that wasn't pressed
|
|
391
|
-
var _iterator3 = _createForOfIteratorHelper(hotkey.modifiers),
|
|
392
|
-
_step3;
|
|
393
|
-
|
|
394
|
-
try {
|
|
395
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
396
|
-
var modifier = _step3.value;
|
|
397
|
-
if (!event[modifier]) continue outer;
|
|
398
|
-
} // Everything matches.
|
|
399
|
-
|
|
400
|
-
} catch (err) {
|
|
401
|
-
_iterator3.e(err);
|
|
402
|
-
} finally {
|
|
403
|
-
_iterator3.f();
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
this.handleClick(hotkey.command, event);
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
250
|
+
}
|
|
251
|
+
handleKeydown(event) {
|
|
252
|
+
outer: for (let hotkey of this.hotkeys) {
|
|
253
|
+
if (hotkey.key && event.key.toLowerCase() == hotkey.key || hotkey.code && event.code == hotkey.code) {
|
|
254
|
+
// Key matches hotkey. Look for any required modifier that wasn't pressed
|
|
255
|
+
for (let modifier of hotkey.modifiers) {
|
|
256
|
+
if (!event[modifier]) continue outer;
|
|
409
257
|
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
_iterator2.f();
|
|
258
|
+
// Everything matches.
|
|
259
|
+
this.handleClick(hotkey.command, event);
|
|
260
|
+
return;
|
|
414
261
|
}
|
|
415
262
|
}
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
}();
|
|
420
|
-
|
|
421
|
-
var _default = CommandBar;
|
|
422
|
-
exports.default = _default;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
var _default = exports.default = CommandBar;
|