@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.
- package/package.json +27 -19
- package/src/command.js +209 -238
- package/src/commandcollection.js +84 -96
- package/src/context.js +219 -314
- package/src/contextplugin.js +29 -36
- package/src/editingkeystrokehandler.js +42 -49
- package/src/editor/editor.js +360 -440
- package/src/editor/editorconfig.js +5 -0
- package/src/editor/editorui.js +436 -544
- package/src/editor/utils/attachtoform.js +39 -49
- package/src/editor/utils/dataapimixin.js +17 -68
- package/src/editor/utils/elementapimixin.js +32 -67
- package/src/editor/utils/securesourceelement.js +22 -32
- package/src/index.js +34 -51
- package/src/multicommand.js +59 -73
- package/src/pendingactions.js +77 -103
- package/src/plugin.js +119 -276
- package/src/plugincollection.js +470 -584
- package/src/editor/editorconfig.jsdoc +0 -426
- package/src/editor/editorwithui.jsdoc +0 -29
|
@@ -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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
}
|