@ckeditor/ckeditor5-core 35.2.1 → 35.3.0

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.
@@ -2,13 +2,10 @@
2
2
  * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
-
6
5
  /**
7
6
  * @module core/editingkeystrokehandler
8
7
  */
9
-
10
8
  import KeystrokeHandler from '@ckeditor/ckeditor5-utils/src/keystrokehandler';
11
-
12
9
  /**
13
10
  * A keystroke handler for editor editing. Its instance is available
14
11
  * in {@link module:core/editor/editor~Editor#keystrokes} so plugins
@@ -23,50 +20,46 @@ import KeystrokeHandler from '@ckeditor/ckeditor5-utils/src/keystrokehandler';
23
20
  * @extends module:utils/keystrokehandler~KeystrokeHandler
24
21
  */
25
22
  export default class EditingKeystrokeHandler extends KeystrokeHandler {
26
- /**
27
- * Creates an instance of the keystroke handler.
28
- *
29
- * @param {module:core/editor/editor~Editor} editor
30
- */
31
- constructor( editor ) {
32
- super();
33
-
34
- /**
35
- * The editor instance.
36
- *
37
- * @readonly
38
- * @member {module:core/editor/editor~Editor}
39
- */
40
- this.editor = editor;
41
- }
42
-
43
- /**
44
- * Registers a handler for the specified keystroke.
45
- *
46
- * The handler can be specified as a command name or a callback.
47
- *
48
- * @param {String|Array.<String|Number>} keystroke Keystroke defined in a format accepted by
49
- * the {@link module:utils/keyboard~parseKeystroke} function.
50
- * @param {Function|String} callback If a string is passed, then the keystroke will
51
- * {@link module:core/editor/editor~Editor#execute execute a command}.
52
- * If a function, then it will be called with the
53
- * {@link module:engine/view/observer/keyobserver~KeyEventData key event data} object and
54
- * a `cancel()` helper to both `preventDefault()` and `stopPropagation()` of the event.
55
- * @param {Object} [options={}] Additional options.
56
- * @param {module:utils/priorities~PriorityString|Number} [options.priority='normal'] The priority of the keystroke
57
- * callback. The higher the priority value the sooner the callback will be executed. Keystrokes having the same priority
58
- * are called in the order they were added.
59
- */
60
- set( keystroke, callback, options = {} ) {
61
- if ( typeof callback == 'string' ) {
62
- const commandName = callback;
63
-
64
- callback = ( evtData, cancel ) => {
65
- this.editor.execute( commandName );
66
- cancel();
67
- };
68
- }
69
-
70
- super.set( keystroke, callback, options );
71
- }
23
+ /**
24
+ * Creates an instance of the keystroke handler.
25
+ *
26
+ * @param {module:core/editor/editor~Editor} editor
27
+ */
28
+ constructor(editor) {
29
+ super();
30
+ /**
31
+ * The editor instance.
32
+ *
33
+ * @readonly
34
+ * @member {module:core/editor/editor~Editor}
35
+ */
36
+ this.editor = editor;
37
+ }
38
+ /**
39
+ * Registers a handler for the specified keystroke.
40
+ *
41
+ * The handler can be specified as a command name or a callback.
42
+ *
43
+ * @param {String|Array.<String|Number>} keystroke Keystroke defined in a format accepted by
44
+ * the {@link module:utils/keyboard~parseKeystroke} function.
45
+ * @param {Function|String} callback If a string is passed, then the keystroke will
46
+ * {@link module:core/editor/editor~Editor#execute execute a command}.
47
+ * If a function, then it will be called with the
48
+ * {@link module:engine/view/observer/keyobserver~KeyEventData key event data} object and
49
+ * a `cancel()` helper to both `preventDefault()` and `stopPropagation()` of the event.
50
+ * @param {Object} [options={}] Additional options.
51
+ * @param {module:utils/priorities~PriorityString|Number} [options.priority='normal'] The priority of the keystroke
52
+ * callback. The higher the priority value the sooner the callback will be executed. Keystrokes having the same priority
53
+ * are called in the order they were added.
54
+ */
55
+ set(keystroke, callback, options = {}) {
56
+ if (typeof callback == 'string') {
57
+ const commandName = callback;
58
+ callback = (evtData, cancel) => {
59
+ this.editor.execute(commandName);
60
+ cancel();
61
+ };
62
+ }
63
+ super.set(keystroke, callback, options);
64
+ }
72
65
  }