@ckeditor/ckeditor5-core 41.3.0-alpha.0 → 41.3.0-alpha.2
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/dist/translations/af.d.ts +8 -0
- package/dist/translations/af.js +5 -0
- package/dist/translations/ar.d.ts +8 -0
- package/dist/translations/ar.js +5 -0
- package/dist/translations/ast.d.ts +8 -0
- package/dist/translations/ast.js +5 -0
- package/dist/translations/az.d.ts +8 -0
- package/dist/translations/az.js +5 -0
- package/dist/translations/bg.d.ts +8 -0
- package/dist/translations/bg.js +5 -0
- package/dist/translations/bn.d.ts +8 -0
- package/dist/translations/bn.js +5 -0
- package/dist/translations/bs.d.ts +8 -0
- package/dist/translations/bs.js +5 -0
- package/dist/translations/ca.d.ts +8 -0
- package/dist/translations/ca.js +5 -0
- package/dist/translations/cs.d.ts +8 -0
- package/dist/translations/cs.js +5 -0
- package/dist/translations/da.d.ts +8 -0
- package/dist/translations/da.js +5 -0
- package/dist/translations/de-ch.d.ts +8 -0
- package/dist/translations/de-ch.js +5 -0
- package/dist/translations/de.d.ts +8 -0
- package/dist/translations/de.js +5 -0
- package/dist/translations/el.d.ts +8 -0
- package/dist/translations/el.js +5 -0
- package/dist/translations/en-au.d.ts +8 -0
- package/dist/translations/en-au.js +5 -0
- package/dist/translations/en-gb.d.ts +8 -0
- package/dist/translations/en-gb.js +5 -0
- package/dist/translations/en.d.ts +8 -0
- package/dist/translations/en.js +5 -0
- package/dist/translations/eo.d.ts +8 -0
- package/dist/translations/eo.js +5 -0
- package/dist/translations/es-co.d.ts +8 -0
- package/dist/translations/es-co.js +5 -0
- package/dist/translations/es.d.ts +8 -0
- package/dist/translations/es.js +5 -0
- package/dist/translations/et.d.ts +8 -0
- package/dist/translations/et.js +5 -0
- package/dist/translations/eu.d.ts +8 -0
- package/dist/translations/eu.js +5 -0
- package/dist/translations/fa.d.ts +8 -0
- package/dist/translations/fa.js +5 -0
- package/dist/translations/fi.d.ts +8 -0
- package/dist/translations/fi.js +5 -0
- package/dist/translations/fr.d.ts +8 -0
- package/dist/translations/fr.js +5 -0
- package/dist/translations/gl.d.ts +8 -0
- package/dist/translations/gl.js +5 -0
- package/dist/translations/gu.d.ts +8 -0
- package/dist/translations/gu.js +5 -0
- package/dist/translations/he.d.ts +8 -0
- package/dist/translations/he.js +5 -0
- package/dist/translations/hi.d.ts +8 -0
- package/dist/translations/hi.js +5 -0
- package/dist/translations/hr.d.ts +8 -0
- package/dist/translations/hr.js +5 -0
- package/dist/translations/hu.d.ts +8 -0
- package/dist/translations/hu.js +5 -0
- package/dist/translations/hy.d.ts +8 -0
- package/dist/translations/hy.js +5 -0
- package/dist/translations/id.d.ts +8 -0
- package/dist/translations/id.js +5 -0
- package/dist/translations/it.d.ts +8 -0
- package/dist/translations/it.js +5 -0
- package/dist/translations/ja.d.ts +8 -0
- package/dist/translations/ja.js +5 -0
- package/dist/translations/jv.d.ts +8 -0
- package/dist/translations/jv.js +5 -0
- package/dist/translations/km.d.ts +8 -0
- package/dist/translations/km.js +5 -0
- package/dist/translations/kn.d.ts +8 -0
- package/dist/translations/kn.js +5 -0
- package/dist/translations/ko.d.ts +8 -0
- package/dist/translations/ko.js +5 -0
- package/dist/translations/ku.d.ts +8 -0
- package/dist/translations/ku.js +5 -0
- package/dist/translations/lt.d.ts +8 -0
- package/dist/translations/lt.js +5 -0
- package/dist/translations/lv.d.ts +8 -0
- package/dist/translations/lv.js +5 -0
- package/dist/translations/ms.d.ts +8 -0
- package/dist/translations/ms.js +5 -0
- package/dist/translations/nb.d.ts +8 -0
- package/dist/translations/nb.js +5 -0
- package/dist/translations/ne.d.ts +8 -0
- package/dist/translations/ne.js +5 -0
- package/dist/translations/nl.d.ts +8 -0
- package/dist/translations/nl.js +5 -0
- package/dist/translations/no.d.ts +8 -0
- package/dist/translations/no.js +5 -0
- package/dist/translations/oc.d.ts +8 -0
- package/dist/translations/oc.js +5 -0
- package/dist/translations/pl.d.ts +8 -0
- package/dist/translations/pl.js +5 -0
- package/dist/translations/pt-br.d.ts +8 -0
- package/dist/translations/pt-br.js +5 -0
- package/dist/translations/pt.d.ts +8 -0
- package/dist/translations/pt.js +5 -0
- package/dist/translations/ro.d.ts +8 -0
- package/dist/translations/ro.js +5 -0
- package/dist/translations/ru.d.ts +8 -0
- package/dist/translations/ru.js +5 -0
- package/dist/translations/si.d.ts +8 -0
- package/dist/translations/si.js +5 -0
- package/dist/translations/sk.d.ts +8 -0
- package/dist/translations/sk.js +5 -0
- package/dist/translations/sl.d.ts +8 -0
- package/dist/translations/sl.js +5 -0
- package/dist/translations/sq.d.ts +8 -0
- package/dist/translations/sq.js +5 -0
- package/dist/translations/sr-latn.d.ts +8 -0
- package/dist/translations/sr-latn.js +5 -0
- package/dist/translations/sr.d.ts +8 -0
- package/dist/translations/sr.js +5 -0
- package/dist/translations/sv.d.ts +8 -0
- package/dist/translations/sv.js +5 -0
- package/dist/translations/th.d.ts +8 -0
- package/dist/translations/th.js +5 -0
- package/dist/translations/tk.d.ts +8 -0
- package/dist/translations/tk.js +5 -0
- package/dist/translations/tr.d.ts +8 -0
- package/dist/translations/tr.js +5 -0
- package/dist/translations/tt.d.ts +8 -0
- package/dist/translations/tt.js +5 -0
- package/dist/translations/ug.d.ts +8 -0
- package/dist/translations/ug.js +5 -0
- package/dist/translations/uk.d.ts +8 -0
- package/dist/translations/uk.js +5 -0
- package/dist/translations/ur.d.ts +8 -0
- package/dist/translations/ur.js +5 -0
- package/dist/translations/uz.d.ts +8 -0
- package/dist/translations/uz.js +5 -0
- package/dist/translations/vi.d.ts +8 -0
- package/dist/translations/vi.js +5 -0
- package/dist/translations/zh-cn.d.ts +8 -0
- package/dist/translations/zh-cn.js +5 -0
- package/dist/translations/zh.d.ts +8 -0
- package/dist/translations/zh.js +5 -0
- package/dist/types/accessibility.d.ts +4 -0
- package/dist/types/augmentation.d.ts +4 -0
- package/dist/types/command.d.ts +4 -0
- package/dist/types/commandcollection.d.ts +4 -0
- package/dist/types/context.d.ts +4 -0
- package/dist/types/contextplugin.d.ts +4 -0
- package/dist/types/editingkeystrokehandler.d.ts +4 -0
- package/dist/types/editor/editor.d.ts +4 -0
- package/dist/types/editor/editorconfig.d.ts +4 -0
- package/dist/types/editor/utils/attachtoform.d.ts +4 -0
- package/dist/types/editor/utils/dataapimixin.d.ts +4 -0
- package/dist/types/editor/utils/elementapimixin.d.ts +4 -0
- package/dist/types/editor/utils/securesourceelement.d.ts +4 -0
- package/dist/types/index.d.ts +5 -1
- package/dist/types/multicommand.d.ts +4 -0
- package/dist/types/pendingactions.d.ts +4 -0
- package/dist/types/plugin.d.ts +4 -0
- package/dist/types/plugincollection.d.ts +4 -0
- package/dist/types/typings.d.ts +7 -0
- package/package.json +3 -3
- package/src/index.d.ts +1 -1
- package/src/typings.d.ts +3 -0
- package/dist/index.js +0 -2411
- package/dist/index.js.map +0 -1
package/dist/index.js
DELETED
|
@@ -1,2411 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
import { ObservableMixin, insertToPriorityArray, EmitterMixin, CKEditorError, Config, Locale, Collection, KeystrokeHandler, setDataInElement } from '@ckeditor/ckeditor5-utils/dist/index.js';
|
|
6
|
-
import { Model, StylesProcessor, DataController, EditingController, Conversion } from '@ckeditor/ckeditor5-engine/dist/index.js';
|
|
7
|
-
import { isFunction } from 'lodash-es';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
11
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* @module core/plugin
|
|
15
|
-
*/
|
|
16
|
-
/* eslint-disable @typescript-eslint/no-invalid-void-type */
|
|
17
|
-
/**
|
|
18
|
-
* The base class for CKEditor plugin classes.
|
|
19
|
-
*/
|
|
20
|
-
class Plugin extends ObservableMixin() {
|
|
21
|
-
/**
|
|
22
|
-
* @inheritDoc
|
|
23
|
-
*/
|
|
24
|
-
constructor(editor) {
|
|
25
|
-
super();
|
|
26
|
-
/**
|
|
27
|
-
* Holds identifiers for {@link #forceDisabled} mechanism.
|
|
28
|
-
*/
|
|
29
|
-
this._disableStack = new Set();
|
|
30
|
-
this.editor = editor;
|
|
31
|
-
this.set('isEnabled', true);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Disables the plugin.
|
|
35
|
-
*
|
|
36
|
-
* Plugin may be disabled by multiple features or algorithms (at once). When disabling a plugin, unique id should be passed
|
|
37
|
-
* (e.g. feature name). The same identifier should be used when {@link #clearForceDisabled enabling back} the plugin.
|
|
38
|
-
* The plugin becomes enabled only after all features {@link #clearForceDisabled enabled it back}.
|
|
39
|
-
*
|
|
40
|
-
* Disabling and enabling a plugin:
|
|
41
|
-
*
|
|
42
|
-
* ```ts
|
|
43
|
-
* plugin.isEnabled; // -> true
|
|
44
|
-
* plugin.forceDisabled( 'MyFeature' );
|
|
45
|
-
* plugin.isEnabled; // -> false
|
|
46
|
-
* plugin.clearForceDisabled( 'MyFeature' );
|
|
47
|
-
* plugin.isEnabled; // -> true
|
|
48
|
-
* ```
|
|
49
|
-
*
|
|
50
|
-
* Plugin disabled by multiple features:
|
|
51
|
-
*
|
|
52
|
-
* ```ts
|
|
53
|
-
* plugin.forceDisabled( 'MyFeature' );
|
|
54
|
-
* plugin.forceDisabled( 'OtherFeature' );
|
|
55
|
-
* plugin.clearForceDisabled( 'MyFeature' );
|
|
56
|
-
* plugin.isEnabled; // -> false
|
|
57
|
-
* plugin.clearForceDisabled( 'OtherFeature' );
|
|
58
|
-
* plugin.isEnabled; // -> true
|
|
59
|
-
* ```
|
|
60
|
-
*
|
|
61
|
-
* Multiple disabling with the same identifier is redundant:
|
|
62
|
-
*
|
|
63
|
-
* ```ts
|
|
64
|
-
* plugin.forceDisabled( 'MyFeature' );
|
|
65
|
-
* plugin.forceDisabled( 'MyFeature' );
|
|
66
|
-
* plugin.clearForceDisabled( 'MyFeature' );
|
|
67
|
-
* plugin.isEnabled; // -> true
|
|
68
|
-
* ```
|
|
69
|
-
*
|
|
70
|
-
* **Note:** some plugins or algorithms may have more complex logic when it comes to enabling or disabling certain plugins,
|
|
71
|
-
* so the plugin might be still disabled after {@link #clearForceDisabled} was used.
|
|
72
|
-
*
|
|
73
|
-
* @param id Unique identifier for disabling. Use the same id when {@link #clearForceDisabled enabling back} the plugin.
|
|
74
|
-
*/
|
|
75
|
-
forceDisabled(id) {
|
|
76
|
-
this._disableStack.add(id);
|
|
77
|
-
if (this._disableStack.size == 1) {
|
|
78
|
-
this.on('set:isEnabled', forceDisable$1, { priority: 'highest' });
|
|
79
|
-
this.isEnabled = false;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Clears forced disable previously set through {@link #forceDisabled}. See {@link #forceDisabled}.
|
|
84
|
-
*
|
|
85
|
-
* @param id Unique identifier, equal to the one passed in {@link #forceDisabled} call.
|
|
86
|
-
*/
|
|
87
|
-
clearForceDisabled(id) {
|
|
88
|
-
this._disableStack.delete(id);
|
|
89
|
-
if (this._disableStack.size == 0) {
|
|
90
|
-
this.off('set:isEnabled', forceDisable$1);
|
|
91
|
-
this.isEnabled = true;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* @inheritDoc
|
|
96
|
-
*/
|
|
97
|
-
destroy() {
|
|
98
|
-
this.stopListening();
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* @inheritDoc
|
|
102
|
-
*/
|
|
103
|
-
static get isContextPlugin() {
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Helper function that forces plugin to be disabled.
|
|
109
|
-
*/
|
|
110
|
-
function forceDisable$1(evt) {
|
|
111
|
-
evt.return = false;
|
|
112
|
-
evt.stop();
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
117
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
118
|
-
*/
|
|
119
|
-
/**
|
|
120
|
-
* @module core/command
|
|
121
|
-
*/
|
|
122
|
-
/**
|
|
123
|
-
* Base class for the CKEditor commands.
|
|
124
|
-
*
|
|
125
|
-
* Commands are the main way to manipulate the editor contents and state. They are mostly used by UI elements (or by other
|
|
126
|
-
* commands) to make changes in the model. Commands are available in every part of the code that has access to
|
|
127
|
-
* the {@link module:core/editor/editor~Editor editor} instance.
|
|
128
|
-
*
|
|
129
|
-
* Instances of registered commands can be retrieved from {@link module:core/editor/editor~Editor#commands `editor.commands`}.
|
|
130
|
-
* The easiest way to execute a command is through {@link module:core/editor/editor~Editor#execute `editor.execute()`}.
|
|
131
|
-
*
|
|
132
|
-
* By default, commands are disabled when the editor is in the {@link module:core/editor/editor~Editor#isReadOnly read-only} mode
|
|
133
|
-
* but commands with the {@link module:core/command~Command#affectsData `affectsData`} flag set to `false` will not be disabled.
|
|
134
|
-
*/
|
|
135
|
-
class Command extends ObservableMixin() {
|
|
136
|
-
/**
|
|
137
|
-
* Creates a new `Command` instance.
|
|
138
|
-
*
|
|
139
|
-
* @param editor The editor on which this command will be used.
|
|
140
|
-
*/
|
|
141
|
-
constructor(editor) {
|
|
142
|
-
super();
|
|
143
|
-
this.editor = editor;
|
|
144
|
-
this.set('value', undefined);
|
|
145
|
-
this.set('isEnabled', false);
|
|
146
|
-
this._affectsData = true;
|
|
147
|
-
this._isEnabledBasedOnSelection = true;
|
|
148
|
-
this._disableStack = new Set();
|
|
149
|
-
this.decorate('execute');
|
|
150
|
-
// By default, every command is refreshed when changes are applied to the model.
|
|
151
|
-
this.listenTo(this.editor.model.document, 'change', () => {
|
|
152
|
-
this.refresh();
|
|
153
|
-
});
|
|
154
|
-
this.listenTo(editor, 'change:isReadOnly', () => {
|
|
155
|
-
this.refresh();
|
|
156
|
-
});
|
|
157
|
-
// By default, commands are disabled if the selection is in non-editable place or editor is in read-only mode.
|
|
158
|
-
this.on('set:isEnabled', evt => {
|
|
159
|
-
if (!this.affectsData) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
const selection = editor.model.document.selection;
|
|
163
|
-
const selectionInGraveyard = selection.getFirstPosition().root.rootName == '$graveyard';
|
|
164
|
-
const canEditAtSelection = !selectionInGraveyard && editor.model.canEditAt(selection);
|
|
165
|
-
// Disable if editor is read only, or when selection is in a place which cannot be edited.
|
|
166
|
-
//
|
|
167
|
-
// Checking `editor.isReadOnly` is needed for all commands that have `_isEnabledBasedOnSelection == false`.
|
|
168
|
-
// E.g. undo does not base on selection, but affects data and should be disabled when the editor is in read-only mode.
|
|
169
|
-
if (editor.isReadOnly || this._isEnabledBasedOnSelection && !canEditAtSelection) {
|
|
170
|
-
evt.return = false;
|
|
171
|
-
evt.stop();
|
|
172
|
-
}
|
|
173
|
-
}, { priority: 'highest' });
|
|
174
|
-
this.on('execute', evt => {
|
|
175
|
-
if (!this.isEnabled) {
|
|
176
|
-
evt.stop();
|
|
177
|
-
}
|
|
178
|
-
}, { priority: 'high' });
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* A flag indicating whether a command execution changes the editor data or not.
|
|
182
|
-
*
|
|
183
|
-
* Commands with `affectsData` set to `false` will not be automatically disabled in
|
|
184
|
-
* the {@link module:core/editor/editor~Editor#isReadOnly read-only mode} and
|
|
185
|
-
* {@glink features/read-only#related-features other editor modes} with restricted user write permissions.
|
|
186
|
-
*
|
|
187
|
-
* **Note:** You do not have to set it for your every command. It is `true` by default.
|
|
188
|
-
*
|
|
189
|
-
* @default true
|
|
190
|
-
*/
|
|
191
|
-
get affectsData() {
|
|
192
|
-
return this._affectsData;
|
|
193
|
-
}
|
|
194
|
-
set affectsData(affectsData) {
|
|
195
|
-
this._affectsData = affectsData;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Refreshes the command. The command should update its {@link #isEnabled} and {@link #value} properties
|
|
199
|
-
* in this method.
|
|
200
|
-
*
|
|
201
|
-
* This method is automatically called when
|
|
202
|
-
* {@link module:engine/model/document~Document#event:change any changes are applied to the document}.
|
|
203
|
-
*/
|
|
204
|
-
refresh() {
|
|
205
|
-
this.isEnabled = true;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Disables the command.
|
|
209
|
-
*
|
|
210
|
-
* Command may be disabled by multiple features or algorithms (at once). When disabling a command, unique id should be passed
|
|
211
|
-
* (e.g. the feature name). The same identifier should be used when {@link #clearForceDisabled enabling back} the command.
|
|
212
|
-
* The command becomes enabled only after all features {@link #clearForceDisabled enabled it back}.
|
|
213
|
-
*
|
|
214
|
-
* Disabling and enabling a command:
|
|
215
|
-
*
|
|
216
|
-
* ```ts
|
|
217
|
-
* command.isEnabled; // -> true
|
|
218
|
-
* command.forceDisabled( 'MyFeature' );
|
|
219
|
-
* command.isEnabled; // -> false
|
|
220
|
-
* command.clearForceDisabled( 'MyFeature' );
|
|
221
|
-
* command.isEnabled; // -> true
|
|
222
|
-
* ```
|
|
223
|
-
*
|
|
224
|
-
* Command disabled by multiple features:
|
|
225
|
-
*
|
|
226
|
-
* ```ts
|
|
227
|
-
* command.forceDisabled( 'MyFeature' );
|
|
228
|
-
* command.forceDisabled( 'OtherFeature' );
|
|
229
|
-
* command.clearForceDisabled( 'MyFeature' );
|
|
230
|
-
* command.isEnabled; // -> false
|
|
231
|
-
* command.clearForceDisabled( 'OtherFeature' );
|
|
232
|
-
* command.isEnabled; // -> true
|
|
233
|
-
* ```
|
|
234
|
-
*
|
|
235
|
-
* Multiple disabling with the same identifier is redundant:
|
|
236
|
-
*
|
|
237
|
-
* ```ts
|
|
238
|
-
* command.forceDisabled( 'MyFeature' );
|
|
239
|
-
* command.forceDisabled( 'MyFeature' );
|
|
240
|
-
* command.clearForceDisabled( 'MyFeature' );
|
|
241
|
-
* command.isEnabled; // -> true
|
|
242
|
-
* ```
|
|
243
|
-
*
|
|
244
|
-
* **Note:** some commands or algorithms may have more complex logic when it comes to enabling or disabling certain commands,
|
|
245
|
-
* so the command might be still disabled after {@link #clearForceDisabled} was used.
|
|
246
|
-
*
|
|
247
|
-
* @param id Unique identifier for disabling. Use the same id when {@link #clearForceDisabled enabling back} the command.
|
|
248
|
-
*/
|
|
249
|
-
forceDisabled(id) {
|
|
250
|
-
this._disableStack.add(id);
|
|
251
|
-
if (this._disableStack.size == 1) {
|
|
252
|
-
this.on('set:isEnabled', forceDisable, { priority: 'highest' });
|
|
253
|
-
this.isEnabled = false;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Clears forced disable previously set through {@link #forceDisabled}. See {@link #forceDisabled}.
|
|
258
|
-
*
|
|
259
|
-
* @param id Unique identifier, equal to the one passed in {@link #forceDisabled} call.
|
|
260
|
-
*/
|
|
261
|
-
clearForceDisabled(id) {
|
|
262
|
-
this._disableStack.delete(id);
|
|
263
|
-
if (this._disableStack.size == 0) {
|
|
264
|
-
this.off('set:isEnabled', forceDisable);
|
|
265
|
-
this.refresh();
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Executes the command.
|
|
270
|
-
*
|
|
271
|
-
* A command may accept parameters. They will be passed from {@link module:core/editor/editor~Editor#execute `editor.execute()`}
|
|
272
|
-
* to the command.
|
|
273
|
-
*
|
|
274
|
-
* The `execute()` method will automatically abort when the command is disabled ({@link #isEnabled} is `false`).
|
|
275
|
-
* This behavior is implemented by a high priority listener to the {@link #event:execute} event.
|
|
276
|
-
*
|
|
277
|
-
* In order to see how to disable a command from "outside" see the {@link #isEnabled} documentation.
|
|
278
|
-
*
|
|
279
|
-
* This method may return a value, which would be forwarded all the way down to the
|
|
280
|
-
* {@link module:core/editor/editor~Editor#execute `editor.execute()`}.
|
|
281
|
-
*
|
|
282
|
-
* @fires execute
|
|
283
|
-
*/
|
|
284
|
-
execute(...args) { return undefined; } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
285
|
-
/**
|
|
286
|
-
* Destroys the command.
|
|
287
|
-
*/
|
|
288
|
-
destroy() {
|
|
289
|
-
this.stopListening();
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Helper function that forces command to be disabled.
|
|
294
|
-
*/
|
|
295
|
-
function forceDisable(evt) {
|
|
296
|
-
evt.return = false;
|
|
297
|
-
evt.stop();
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
302
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
303
|
-
*/
|
|
304
|
-
/**
|
|
305
|
-
* @module core/multicommand
|
|
306
|
-
*/
|
|
307
|
-
/**
|
|
308
|
-
* A CKEditor command that aggregates other commands.
|
|
309
|
-
*
|
|
310
|
-
* This command is used to proxy multiple commands. The multi-command is enabled when
|
|
311
|
-
* at least one of its registered child commands is enabled.
|
|
312
|
-
* When executing a multi-command, the first enabled command with highest priority will be executed.
|
|
313
|
-
*
|
|
314
|
-
* ```ts
|
|
315
|
-
* const multiCommand = new MultiCommand( editor );
|
|
316
|
-
*
|
|
317
|
-
* const commandFoo = new Command( editor );
|
|
318
|
-
* const commandBar = new Command( editor );
|
|
319
|
-
*
|
|
320
|
-
* // Register a child command.
|
|
321
|
-
* multiCommand.registerChildCommand( commandFoo );
|
|
322
|
-
* // Register a child command with a low priority.
|
|
323
|
-
* multiCommand.registerChildCommand( commandBar, { priority: 'low' } );
|
|
324
|
-
*
|
|
325
|
-
* // Enable one of the commands.
|
|
326
|
-
* commandBar.isEnabled = true;
|
|
327
|
-
*
|
|
328
|
-
* multiCommand.execute(); // Will execute commandBar.
|
|
329
|
-
* ```
|
|
330
|
-
*/
|
|
331
|
-
class MultiCommand extends Command {
|
|
332
|
-
constructor() {
|
|
333
|
-
super(...arguments);
|
|
334
|
-
/**
|
|
335
|
-
* Registered child commands definitions.
|
|
336
|
-
*/
|
|
337
|
-
this._childCommandsDefinitions = [];
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* @inheritDoc
|
|
341
|
-
*/
|
|
342
|
-
refresh() {
|
|
343
|
-
// Override base command refresh(): the command's state is changed when one of child commands changes states.
|
|
344
|
-
}
|
|
345
|
-
/**
|
|
346
|
-
* Executes the first enabled command which has the highest priority of all registered child commands.
|
|
347
|
-
*
|
|
348
|
-
* @returns The value returned by the {@link module:core/command~Command#execute `command.execute()`}.
|
|
349
|
-
*/
|
|
350
|
-
execute(...args) {
|
|
351
|
-
const command = this._getFirstEnabledCommand();
|
|
352
|
-
return !!command && command.execute(args);
|
|
353
|
-
}
|
|
354
|
-
/**
|
|
355
|
-
* Registers a child command.
|
|
356
|
-
*
|
|
357
|
-
* @param options An object with configuration options.
|
|
358
|
-
* @param options.priority Priority of a command to register.
|
|
359
|
-
*/
|
|
360
|
-
registerChildCommand(command, options = {}) {
|
|
361
|
-
insertToPriorityArray(this._childCommandsDefinitions, { command, priority: options.priority || 'normal' });
|
|
362
|
-
// Change multi-command enabled state when one of registered commands changes state.
|
|
363
|
-
command.on('change:isEnabled', () => this._checkEnabled());
|
|
364
|
-
this._checkEnabled();
|
|
365
|
-
}
|
|
366
|
-
/**
|
|
367
|
-
* Checks if any of child commands is enabled.
|
|
368
|
-
*/
|
|
369
|
-
_checkEnabled() {
|
|
370
|
-
this.isEnabled = !!this._getFirstEnabledCommand();
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Returns a first enabled command with the highest priority or `undefined` if none of them is enabled.
|
|
374
|
-
*/
|
|
375
|
-
_getFirstEnabledCommand() {
|
|
376
|
-
const commandDefinition = this._childCommandsDefinitions.find(({ command }) => command.isEnabled);
|
|
377
|
-
return commandDefinition && commandDefinition.command;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
383
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
384
|
-
*/
|
|
385
|
-
/**
|
|
386
|
-
* @module core/plugincollection
|
|
387
|
-
*/
|
|
388
|
-
/**
|
|
389
|
-
* Manages a list of CKEditor plugins, including loading, resolving dependencies and initialization.
|
|
390
|
-
*/
|
|
391
|
-
class PluginCollection extends EmitterMixin() {
|
|
392
|
-
/**
|
|
393
|
-
* Creates an instance of the plugin collection class.
|
|
394
|
-
* Allows loading and initializing plugins and their dependencies.
|
|
395
|
-
* Allows providing a list of already loaded plugins. These plugins will not be destroyed along with this collection.
|
|
396
|
-
*
|
|
397
|
-
* @param availablePlugins Plugins (constructors) which the collection will be able to use
|
|
398
|
-
* when {@link module:core/plugincollection~PluginCollection#init} is used with the plugin names (strings, instead of constructors).
|
|
399
|
-
* Usually, the editor will pass its built-in plugins to the collection so they can later be
|
|
400
|
-
* used in `config.plugins` or `config.removePlugins` by names.
|
|
401
|
-
* @param contextPlugins A list of already initialized plugins represented by a `[ PluginConstructor, pluginInstance ]` pair.
|
|
402
|
-
*/
|
|
403
|
-
constructor(context, availablePlugins = [], contextPlugins = []) {
|
|
404
|
-
super();
|
|
405
|
-
this._plugins = new Map();
|
|
406
|
-
this._context = context;
|
|
407
|
-
this._availablePlugins = new Map();
|
|
408
|
-
for (const PluginConstructor of availablePlugins) {
|
|
409
|
-
if (PluginConstructor.pluginName) {
|
|
410
|
-
this._availablePlugins.set(PluginConstructor.pluginName, PluginConstructor);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
this._contextPlugins = new Map();
|
|
414
|
-
for (const [PluginConstructor, pluginInstance] of contextPlugins) {
|
|
415
|
-
this._contextPlugins.set(PluginConstructor, pluginInstance);
|
|
416
|
-
this._contextPlugins.set(pluginInstance, PluginConstructor);
|
|
417
|
-
// To make it possible to require a plugin by its name.
|
|
418
|
-
if (PluginConstructor.pluginName) {
|
|
419
|
-
this._availablePlugins.set(PluginConstructor.pluginName, PluginConstructor);
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
/**
|
|
424
|
-
* Iterable interface.
|
|
425
|
-
*
|
|
426
|
-
* Returns `[ PluginConstructor, pluginInstance ]` pairs.
|
|
427
|
-
*/
|
|
428
|
-
*[Symbol.iterator]() {
|
|
429
|
-
for (const entry of this._plugins) {
|
|
430
|
-
if (typeof entry[0] == 'function') {
|
|
431
|
-
yield entry;
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
/**
|
|
436
|
-
* Gets the plugin instance by its constructor or name.
|
|
437
|
-
*
|
|
438
|
-
* ```ts
|
|
439
|
-
* // Check if 'Clipboard' plugin was loaded.
|
|
440
|
-
* if ( editor.plugins.has( 'ClipboardPipeline' ) ) {
|
|
441
|
-
* // Get clipboard plugin instance
|
|
442
|
-
* const clipboard = editor.plugins.get( 'ClipboardPipeline' );
|
|
443
|
-
*
|
|
444
|
-
* this.listenTo( clipboard, 'inputTransformation', ( evt, data ) => {
|
|
445
|
-
* // Do something on clipboard input.
|
|
446
|
-
* } );
|
|
447
|
-
* }
|
|
448
|
-
* ```
|
|
449
|
-
*
|
|
450
|
-
* **Note**: This method will throw an error if a plugin is not loaded. Use `{@link #has editor.plugins.has()}`
|
|
451
|
-
* to check if a plugin is available.
|
|
452
|
-
*
|
|
453
|
-
* @param key The plugin constructor or {@link module:core/plugin~PluginStaticMembers#pluginName name}.
|
|
454
|
-
*/
|
|
455
|
-
get(key) {
|
|
456
|
-
const plugin = this._plugins.get(key);
|
|
457
|
-
if (!plugin) {
|
|
458
|
-
let pluginName = key;
|
|
459
|
-
if (typeof key == 'function') {
|
|
460
|
-
pluginName = key.pluginName || key.name;
|
|
461
|
-
}
|
|
462
|
-
/**
|
|
463
|
-
* The plugin is not loaded and could not be obtained.
|
|
464
|
-
*
|
|
465
|
-
* Plugin classes (constructors) need to be provided to the editor and must be loaded before they can be obtained from
|
|
466
|
-
* the plugin collection.
|
|
467
|
-
* This is usually done in CKEditor 5 builds by setting the {@link module:core/editor/editor~Editor.builtinPlugins}
|
|
468
|
-
* property.
|
|
469
|
-
*
|
|
470
|
-
* **Note**: You can use `{@link module:core/plugincollection~PluginCollection#has editor.plugins.has()}`
|
|
471
|
-
* to check if a plugin was loaded.
|
|
472
|
-
*
|
|
473
|
-
* @error plugincollection-plugin-not-loaded
|
|
474
|
-
* @param plugin The name of the plugin which is not loaded.
|
|
475
|
-
*/
|
|
476
|
-
throw new CKEditorError('plugincollection-plugin-not-loaded', this._context, { plugin: pluginName });
|
|
477
|
-
}
|
|
478
|
-
return plugin;
|
|
479
|
-
}
|
|
480
|
-
/**
|
|
481
|
-
* Checks if a plugin is loaded.
|
|
482
|
-
*
|
|
483
|
-
* ```ts
|
|
484
|
-
* // Check if the 'Clipboard' plugin was loaded.
|
|
485
|
-
* if ( editor.plugins.has( 'ClipboardPipeline' ) ) {
|
|
486
|
-
* // Now use the clipboard plugin instance:
|
|
487
|
-
* const clipboard = editor.plugins.get( 'ClipboardPipeline' );
|
|
488
|
-
*
|
|
489
|
-
* // ...
|
|
490
|
-
* }
|
|
491
|
-
* ```
|
|
492
|
-
*
|
|
493
|
-
* @param key The plugin constructor or {@link module:core/plugin~PluginStaticMembers#pluginName name}.
|
|
494
|
-
*/
|
|
495
|
-
has(key) {
|
|
496
|
-
return this._plugins.has(key);
|
|
497
|
-
}
|
|
498
|
-
/**
|
|
499
|
-
* Initializes a set of plugins and adds them to the collection.
|
|
500
|
-
*
|
|
501
|
-
* @param plugins An array of {@link module:core/plugin~PluginInterface plugin constructors}
|
|
502
|
-
* or {@link module:core/plugin~PluginStaticMembers#pluginName plugin names}.
|
|
503
|
-
* @param pluginsToRemove Names of the plugins or plugin constructors
|
|
504
|
-
* that should not be loaded (despite being specified in the `plugins` array).
|
|
505
|
-
* @param pluginsSubstitutions An array of {@link module:core/plugin~PluginInterface plugin constructors}
|
|
506
|
-
* that will be used to replace plugins of the same names that were passed in `plugins` or that are in their dependency tree.
|
|
507
|
-
* A useful option for replacing built-in plugins while creating tests (for mocking their APIs). Plugins that will be replaced
|
|
508
|
-
* must follow these rules:
|
|
509
|
-
* * The new plugin must be a class.
|
|
510
|
-
* * The new plugin must be named.
|
|
511
|
-
* * Both plugins must not depend on other plugins.
|
|
512
|
-
* @returns A promise which gets resolved once all plugins are loaded and available in the collection.
|
|
513
|
-
*/
|
|
514
|
-
init(plugins, pluginsToRemove = [], pluginsSubstitutions = []) {
|
|
515
|
-
// Plugin initialization procedure consists of 2 main steps:
|
|
516
|
-
// 1) collecting all available plugin constructors,
|
|
517
|
-
// 2) verification whether all required plugins can be instantiated.
|
|
518
|
-
//
|
|
519
|
-
// In the first step, all plugin constructors, available in the provided `plugins` array and inside
|
|
520
|
-
// plugin's dependencies (from the `Plugin.requires` array), are recursively collected and added to the existing
|
|
521
|
-
// `this._availablePlugins` map, but without any verification at the given moment. Performing the verification
|
|
522
|
-
// at this point (during the plugin constructor searching) would cause false errors to occur, that some plugin
|
|
523
|
-
// is missing but in fact it may be defined further in the array as the dependency of other plugin. After
|
|
524
|
-
// traversing the entire dependency tree, it will be checked if all required "top level" plugins are available.
|
|
525
|
-
//
|
|
526
|
-
// In the second step, the list of plugins that have not been explicitly removed is traversed to get all the
|
|
527
|
-
// plugin constructors to be instantiated in the correct order and to validate against some rules. Finally, if
|
|
528
|
-
// no plugin is missing and no other error has been found, they all will be instantiated.
|
|
529
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
530
|
-
const that = this;
|
|
531
|
-
const context = this._context;
|
|
532
|
-
findAvailablePluginConstructors(plugins);
|
|
533
|
-
validatePlugins(plugins);
|
|
534
|
-
const pluginsToLoad = plugins.filter(plugin => !isPluginRemoved(plugin, pluginsToRemove));
|
|
535
|
-
const pluginConstructors = [...getPluginConstructors(pluginsToLoad)];
|
|
536
|
-
substitutePlugins(pluginConstructors, pluginsSubstitutions);
|
|
537
|
-
const pluginInstances = loadPlugins(pluginConstructors);
|
|
538
|
-
return initPlugins(pluginInstances, 'init')
|
|
539
|
-
.then(() => initPlugins(pluginInstances, 'afterInit'))
|
|
540
|
-
.then(() => pluginInstances);
|
|
541
|
-
function isPluginConstructor(plugin) {
|
|
542
|
-
return typeof plugin === 'function';
|
|
543
|
-
}
|
|
544
|
-
function isContextPlugin(plugin) {
|
|
545
|
-
return isPluginConstructor(plugin) && !!plugin.isContextPlugin;
|
|
546
|
-
}
|
|
547
|
-
function isPluginRemoved(plugin, pluginsToRemove) {
|
|
548
|
-
return pluginsToRemove.some(removedPlugin => {
|
|
549
|
-
if (removedPlugin === plugin) {
|
|
550
|
-
return true;
|
|
551
|
-
}
|
|
552
|
-
if (getPluginName(plugin) === removedPlugin) {
|
|
553
|
-
return true;
|
|
554
|
-
}
|
|
555
|
-
if (getPluginName(removedPlugin) === plugin) {
|
|
556
|
-
return true;
|
|
557
|
-
}
|
|
558
|
-
return false;
|
|
559
|
-
});
|
|
560
|
-
}
|
|
561
|
-
function getPluginName(plugin) {
|
|
562
|
-
return isPluginConstructor(plugin) ?
|
|
563
|
-
plugin.pluginName || plugin.name :
|
|
564
|
-
plugin;
|
|
565
|
-
}
|
|
566
|
-
function findAvailablePluginConstructors(plugins, processed = new Set()) {
|
|
567
|
-
plugins.forEach(plugin => {
|
|
568
|
-
if (!isPluginConstructor(plugin)) {
|
|
569
|
-
return;
|
|
570
|
-
}
|
|
571
|
-
if (processed.has(plugin)) {
|
|
572
|
-
return;
|
|
573
|
-
}
|
|
574
|
-
processed.add(plugin);
|
|
575
|
-
if (plugin.pluginName && !that._availablePlugins.has(plugin.pluginName)) {
|
|
576
|
-
that._availablePlugins.set(plugin.pluginName, plugin);
|
|
577
|
-
}
|
|
578
|
-
if (plugin.requires) {
|
|
579
|
-
findAvailablePluginConstructors(plugin.requires, processed);
|
|
580
|
-
}
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
function getPluginConstructors(plugins, processed = new Set()) {
|
|
584
|
-
return plugins
|
|
585
|
-
.map(plugin => {
|
|
586
|
-
return isPluginConstructor(plugin) ?
|
|
587
|
-
plugin :
|
|
588
|
-
that._availablePlugins.get(plugin);
|
|
589
|
-
})
|
|
590
|
-
.reduce((result, plugin) => {
|
|
591
|
-
if (processed.has(plugin)) {
|
|
592
|
-
return result;
|
|
593
|
-
}
|
|
594
|
-
processed.add(plugin);
|
|
595
|
-
if (plugin.requires) {
|
|
596
|
-
validatePlugins(plugin.requires, plugin);
|
|
597
|
-
getPluginConstructors(plugin.requires, processed).forEach(plugin => result.add(plugin));
|
|
598
|
-
}
|
|
599
|
-
return result.add(plugin);
|
|
600
|
-
}, new Set());
|
|
601
|
-
}
|
|
602
|
-
function validatePlugins(plugins, parentPluginConstructor = null) {
|
|
603
|
-
plugins
|
|
604
|
-
.map(plugin => {
|
|
605
|
-
return isPluginConstructor(plugin) ?
|
|
606
|
-
plugin :
|
|
607
|
-
that._availablePlugins.get(plugin) || plugin;
|
|
608
|
-
})
|
|
609
|
-
.forEach(plugin => {
|
|
610
|
-
checkMissingPlugin(plugin, parentPluginConstructor);
|
|
611
|
-
checkContextPlugin(plugin, parentPluginConstructor);
|
|
612
|
-
checkRemovedPlugin(plugin, parentPluginConstructor);
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
|
-
function checkMissingPlugin(plugin, parentPluginConstructor) {
|
|
616
|
-
if (isPluginConstructor(plugin)) {
|
|
617
|
-
return;
|
|
618
|
-
}
|
|
619
|
-
if (parentPluginConstructor) {
|
|
620
|
-
/**
|
|
621
|
-
* A required "soft" dependency was not found on the plugin list.
|
|
622
|
-
*
|
|
623
|
-
* When configuring the editor, either prior to building (via
|
|
624
|
-
* {@link module:core/editor/editor~Editor.builtinPlugins `Editor.builtinPlugins`}) or when
|
|
625
|
-
* creating a new instance of the editor (e.g. via
|
|
626
|
-
* {@link module:core/editor/editorconfig~EditorConfig#plugins `config.plugins`}), you need to provide
|
|
627
|
-
* some of the dependencies for other plugins that you used.
|
|
628
|
-
*
|
|
629
|
-
* This error is thrown when one of these dependencies was not provided. The name of the missing plugin
|
|
630
|
-
* can be found in `missingPlugin` and the plugin that required it in `requiredBy`.
|
|
631
|
-
*
|
|
632
|
-
* In order to resolve it, you need to import the missing plugin and add it to the
|
|
633
|
-
* current list of plugins (`Editor.builtinPlugins` or `config.plugins`/`config.extraPlugins`).
|
|
634
|
-
*
|
|
635
|
-
* Soft requirements were introduced in version 26.0.0. If you happen to stumble upon this error
|
|
636
|
-
* when upgrading to version 26.0.0, read also the
|
|
637
|
-
* {@glink updating/guides/update-to-26 Migration to 26.0.0} guide.
|
|
638
|
-
*
|
|
639
|
-
* @error plugincollection-soft-required
|
|
640
|
-
* @param missingPlugin The name of the required plugin.
|
|
641
|
-
* @param requiredBy The name of the plugin that requires the other plugin.
|
|
642
|
-
*/
|
|
643
|
-
throw new CKEditorError('plugincollection-soft-required', context, { missingPlugin: plugin, requiredBy: getPluginName(parentPluginConstructor) });
|
|
644
|
-
}
|
|
645
|
-
/**
|
|
646
|
-
* A plugin is not available and could not be loaded.
|
|
647
|
-
*
|
|
648
|
-
* Plugin classes (constructors) need to be provided to the editor before they can be loaded by name.
|
|
649
|
-
* This is usually done in CKEditor 5 builds by setting the {@link module:core/editor/editor~Editor.builtinPlugins}
|
|
650
|
-
* property.
|
|
651
|
-
*
|
|
652
|
-
* **If you see this warning when using one of the {@glink installation/getting-started/predefined-builds
|
|
653
|
-
* CKEditor 5 Builds}**,
|
|
654
|
-
* it means that you try to enable a plugin which was not included in that build. This may be due to a typo
|
|
655
|
-
* in the plugin name or simply because that plugin is not a part of this build. In the latter scenario,
|
|
656
|
-
* read more about {@glink installation/getting-started/quick-start custom builds}.
|
|
657
|
-
*
|
|
658
|
-
* **If you see this warning when using one of the editor creators directly** (not a build), then it means
|
|
659
|
-
* that you tried loading plugins by name. However, unlike CKEditor 4, CKEditor 5 does not implement a "plugin loader".
|
|
660
|
-
* This means that CKEditor 5 does not know where to load the plugin modules from. Therefore, you need to
|
|
661
|
-
* provide each plugin through a reference (as a constructor function). Check out the examples in
|
|
662
|
-
* {@glink installation/advanced/alternative-setups/integrating-from-source-webpack "Building from source"}.
|
|
663
|
-
*
|
|
664
|
-
* @error plugincollection-plugin-not-found
|
|
665
|
-
* @param plugin The name of the plugin which could not be loaded.
|
|
666
|
-
*/
|
|
667
|
-
throw new CKEditorError('plugincollection-plugin-not-found', context, { plugin });
|
|
668
|
-
}
|
|
669
|
-
function checkContextPlugin(plugin, parentPluginConstructor) {
|
|
670
|
-
if (!isContextPlugin(parentPluginConstructor)) {
|
|
671
|
-
return;
|
|
672
|
-
}
|
|
673
|
-
if (isContextPlugin(plugin)) {
|
|
674
|
-
return;
|
|
675
|
-
}
|
|
676
|
-
/**
|
|
677
|
-
* If a plugin is a context plugin, all plugins it requires should also be context plugins
|
|
678
|
-
* instead of plugins. In other words, if one plugin can be used in the context,
|
|
679
|
-
* all its requirements should also be ready to be used in the context. Note that the context
|
|
680
|
-
* provides only a part of the API provided by the editor. If one plugin needs a full
|
|
681
|
-
* editor API, all plugins which require it are considered as plugins that need a full
|
|
682
|
-
* editor API.
|
|
683
|
-
*
|
|
684
|
-
* @error plugincollection-context-required
|
|
685
|
-
* @param plugin The name of the required plugin.
|
|
686
|
-
* @param requiredBy The name of the parent plugin.
|
|
687
|
-
*/
|
|
688
|
-
throw new CKEditorError('plugincollection-context-required', context, { plugin: getPluginName(plugin), requiredBy: getPluginName(parentPluginConstructor) });
|
|
689
|
-
}
|
|
690
|
-
function checkRemovedPlugin(plugin, parentPluginConstructor) {
|
|
691
|
-
if (!parentPluginConstructor) {
|
|
692
|
-
return;
|
|
693
|
-
}
|
|
694
|
-
if (!isPluginRemoved(plugin, pluginsToRemove)) {
|
|
695
|
-
return;
|
|
696
|
-
}
|
|
697
|
-
/**
|
|
698
|
-
* Cannot load a plugin because one of its dependencies is listed in the `removePlugins` option.
|
|
699
|
-
*
|
|
700
|
-
* @error plugincollection-required
|
|
701
|
-
* @param plugin The name of the required plugin.
|
|
702
|
-
* @param requiredBy The name of the parent plugin.
|
|
703
|
-
*/
|
|
704
|
-
throw new CKEditorError('plugincollection-required', context, { plugin: getPluginName(plugin), requiredBy: getPluginName(parentPluginConstructor) });
|
|
705
|
-
}
|
|
706
|
-
function loadPlugins(pluginConstructors) {
|
|
707
|
-
return pluginConstructors.map(PluginConstructor => {
|
|
708
|
-
let pluginInstance = that._contextPlugins.get(PluginConstructor);
|
|
709
|
-
pluginInstance = pluginInstance || new PluginConstructor(context);
|
|
710
|
-
that._add(PluginConstructor, pluginInstance);
|
|
711
|
-
return pluginInstance;
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
|
-
function initPlugins(pluginInstances, method) {
|
|
715
|
-
return pluginInstances.reduce((promise, plugin) => {
|
|
716
|
-
if (!plugin[method]) {
|
|
717
|
-
return promise;
|
|
718
|
-
}
|
|
719
|
-
if (that._contextPlugins.has(plugin)) {
|
|
720
|
-
return promise;
|
|
721
|
-
}
|
|
722
|
-
return promise.then(plugin[method].bind(plugin));
|
|
723
|
-
}, Promise.resolve());
|
|
724
|
-
}
|
|
725
|
-
/**
|
|
726
|
-
* Replaces plugin constructors with the specified set of plugins.
|
|
727
|
-
*/
|
|
728
|
-
function substitutePlugins(pluginConstructors, pluginsSubstitutions) {
|
|
729
|
-
for (const pluginItem of pluginsSubstitutions) {
|
|
730
|
-
if (typeof pluginItem != 'function') {
|
|
731
|
-
/**
|
|
732
|
-
* The plugin replacing an existing plugin must be a function.
|
|
733
|
-
*
|
|
734
|
-
* @error plugincollection-replace-plugin-invalid-type
|
|
735
|
-
*/
|
|
736
|
-
throw new CKEditorError('plugincollection-replace-plugin-invalid-type', null, { pluginItem });
|
|
737
|
-
}
|
|
738
|
-
const pluginName = pluginItem.pluginName;
|
|
739
|
-
if (!pluginName) {
|
|
740
|
-
/**
|
|
741
|
-
* The plugin replacing an existing plugin must have a name.
|
|
742
|
-
*
|
|
743
|
-
* @error plugincollection-replace-plugin-missing-name
|
|
744
|
-
*/
|
|
745
|
-
throw new CKEditorError('plugincollection-replace-plugin-missing-name', null, { pluginItem });
|
|
746
|
-
}
|
|
747
|
-
if (pluginItem.requires && pluginItem.requires.length) {
|
|
748
|
-
/**
|
|
749
|
-
* The plugin replacing an existing plugin cannot depend on other plugins.
|
|
750
|
-
*
|
|
751
|
-
* @error plugincollection-plugin-for-replacing-cannot-have-dependencies
|
|
752
|
-
*/
|
|
753
|
-
throw new CKEditorError('plugincollection-plugin-for-replacing-cannot-have-dependencies', null, { pluginName });
|
|
754
|
-
}
|
|
755
|
-
const pluginToReplace = that._availablePlugins.get(pluginName);
|
|
756
|
-
if (!pluginToReplace) {
|
|
757
|
-
/**
|
|
758
|
-
* The replaced plugin does not exist in the
|
|
759
|
-
* {@link module:core/plugincollection~PluginCollection available plugins} collection.
|
|
760
|
-
*
|
|
761
|
-
* @error plugincollection-plugin-for-replacing-not-exist
|
|
762
|
-
*/
|
|
763
|
-
throw new CKEditorError('plugincollection-plugin-for-replacing-not-exist', null, { pluginName });
|
|
764
|
-
}
|
|
765
|
-
const indexInPluginConstructors = pluginConstructors.indexOf(pluginToReplace);
|
|
766
|
-
if (indexInPluginConstructors === -1) {
|
|
767
|
-
// The Context feature can substitute plugins as well.
|
|
768
|
-
// It may happen that the editor will be created with the given context, where the plugin for substitute
|
|
769
|
-
// was already replaced. In such a case, we don't want to do it again.
|
|
770
|
-
if (that._contextPlugins.has(pluginToReplace)) {
|
|
771
|
-
return;
|
|
772
|
-
}
|
|
773
|
-
/**
|
|
774
|
-
* The replaced plugin will not be loaded so it cannot be replaced.
|
|
775
|
-
*
|
|
776
|
-
* @error plugincollection-plugin-for-replacing-not-loaded
|
|
777
|
-
*/
|
|
778
|
-
throw new CKEditorError('plugincollection-plugin-for-replacing-not-loaded', null, { pluginName });
|
|
779
|
-
}
|
|
780
|
-
if (pluginToReplace.requires && pluginToReplace.requires.length) {
|
|
781
|
-
/**
|
|
782
|
-
* The replaced plugin cannot depend on other plugins.
|
|
783
|
-
*
|
|
784
|
-
* @error plugincollection-replaced-plugin-cannot-have-dependencies
|
|
785
|
-
*/
|
|
786
|
-
throw new CKEditorError('plugincollection-replaced-plugin-cannot-have-dependencies', null, { pluginName });
|
|
787
|
-
}
|
|
788
|
-
pluginConstructors.splice(indexInPluginConstructors, 1, pluginItem);
|
|
789
|
-
that._availablePlugins.set(pluginName, pluginItem);
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
/**
|
|
794
|
-
* Destroys all loaded plugins.
|
|
795
|
-
*/
|
|
796
|
-
destroy() {
|
|
797
|
-
const promises = [];
|
|
798
|
-
for (const [, pluginInstance] of this) {
|
|
799
|
-
if (typeof pluginInstance.destroy == 'function' && !this._contextPlugins.has(pluginInstance)) {
|
|
800
|
-
promises.push(pluginInstance.destroy());
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
return Promise.all(promises);
|
|
804
|
-
}
|
|
805
|
-
/**
|
|
806
|
-
* Adds the plugin to the collection. Exposed mainly for testing purposes.
|
|
807
|
-
*
|
|
808
|
-
* @param PluginConstructor The plugin constructor.
|
|
809
|
-
* @param plugin The instance of the plugin.
|
|
810
|
-
*/
|
|
811
|
-
_add(PluginConstructor, plugin) {
|
|
812
|
-
this._plugins.set(PluginConstructor, plugin);
|
|
813
|
-
const pluginName = PluginConstructor.pluginName;
|
|
814
|
-
if (!pluginName) {
|
|
815
|
-
return;
|
|
816
|
-
}
|
|
817
|
-
if (this._plugins.has(pluginName)) {
|
|
818
|
-
/**
|
|
819
|
-
* Two plugins with the same {@link module:core/plugin~PluginStaticMembers#pluginName} were loaded.
|
|
820
|
-
* This will lead to runtime conflicts between these plugins.
|
|
821
|
-
*
|
|
822
|
-
* In practice, this warning usually means that new plugins were added to an existing CKEditor 5 build.
|
|
823
|
-
* Plugins should always be added to a source version of the editor (`@ckeditor/ckeditor5-editor-/dist/index.js*`),
|
|
824
|
-
* not to an editor imported from one of the `@ckeditor/ckeditor5-build-/dist/index.js*` packages.
|
|
825
|
-
*
|
|
826
|
-
* Check your import paths and the list of plugins passed to
|
|
827
|
-
* {@link module:core/editor/editor~Editor.create `Editor.create()`}
|
|
828
|
-
* or specified in {@link module:core/editor/editor~Editor.builtinPlugins `Editor.builtinPlugins`}.
|
|
829
|
-
*
|
|
830
|
-
* The second option is that your `node_modules/` directory contains duplicated versions of the same
|
|
831
|
-
* CKEditor 5 packages. Normally, on clean installations, npm deduplicates packages in `node_modules/`, so
|
|
832
|
-
* it may be enough to call `rm -rf node_modules && npm i`. However, if you installed conflicting versions
|
|
833
|
-
* of some packages, their dependencies may need to be installed in more than one version which may lead to this
|
|
834
|
-
* warning.
|
|
835
|
-
*
|
|
836
|
-
* Technically speaking, this error occurs because after adding a plugin to an existing editor build
|
|
837
|
-
* the dependencies of this plugin are being duplicated.
|
|
838
|
-
* They are already built into that editor build and now get added for the second time as dependencies
|
|
839
|
-
* of the plugin you are installing.
|
|
840
|
-
*
|
|
841
|
-
* Read more about {@glink installation/plugins/installing-plugins Installing plugins}.
|
|
842
|
-
*
|
|
843
|
-
* @error plugincollection-plugin-name-conflict
|
|
844
|
-
* @param pluginName The duplicated plugin name.
|
|
845
|
-
* @param plugin1 The first plugin constructor.
|
|
846
|
-
* @param plugin2 The second plugin constructor.
|
|
847
|
-
*/
|
|
848
|
-
throw new CKEditorError('plugincollection-plugin-name-conflict', null, { pluginName, plugin1: this._plugins.get(pluginName).constructor, plugin2: PluginConstructor });
|
|
849
|
-
}
|
|
850
|
-
this._plugins.set(pluginName, plugin);
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
/**
|
|
855
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
856
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
857
|
-
*/
|
|
858
|
-
/**
|
|
859
|
-
* @module core/context
|
|
860
|
-
*/
|
|
861
|
-
/**
|
|
862
|
-
* Provides a common, higher-level environment for solutions that use multiple {@link module:core/editor/editor~Editor editors}
|
|
863
|
-
* or plugins that work outside the editor. Use it instead of {@link module:core/editor/editor~Editor.create `Editor.create()`}
|
|
864
|
-
* in advanced application integrations.
|
|
865
|
-
*
|
|
866
|
-
* All configuration options passed to a context will be used as default options for the editor instances initialized in that context.
|
|
867
|
-
*
|
|
868
|
-
* {@link module:core/contextplugin~ContextPlugin Context plugins} passed to a context instance will be shared among all
|
|
869
|
-
* editor instances initialized in this context. These will be the same plugin instances for all the editors.
|
|
870
|
-
*
|
|
871
|
-
* **Note:** The context can only be initialized with {@link module:core/contextplugin~ContextPlugin context plugins}
|
|
872
|
-
* (e.g. [comments](https://ckeditor.com/collaboration/comments/)). Regular {@link module:core/plugin~Plugin plugins} require an
|
|
873
|
-
* editor instance to work and cannot be added to a context.
|
|
874
|
-
*
|
|
875
|
-
* **Note:** You can add a context plugin to an editor instance, though.
|
|
876
|
-
*
|
|
877
|
-
* If you are using multiple editor instances on one page and use any context plugins, create a context to share the configuration and
|
|
878
|
-
* plugins among these editors. Some plugins will use the information about all existing editors to better integrate between them.
|
|
879
|
-
*
|
|
880
|
-
* If you are using plugins that do not require an editor to work (e.g. [comments](https://ckeditor.com/collaboration/comments/)),
|
|
881
|
-
* enable and configure them using the context.
|
|
882
|
-
*
|
|
883
|
-
* If you are using only a single editor on each page, use {@link module:core/editor/editor~Editor.create `Editor.create()`} instead.
|
|
884
|
-
* In such a case, a context instance will be created by the editor instance in a transparent way.
|
|
885
|
-
*
|
|
886
|
-
* See {@link ~Context.create `Context.create()`} for usage examples.
|
|
887
|
-
*/
|
|
888
|
-
class Context {
|
|
889
|
-
/**
|
|
890
|
-
* Creates a context instance with a given configuration.
|
|
891
|
-
*
|
|
892
|
-
* Usually not to be used directly. See the static {@link module:core/context~Context.create `create()`} method.
|
|
893
|
-
*
|
|
894
|
-
* @param config The context configuration.
|
|
895
|
-
*/
|
|
896
|
-
constructor(config) {
|
|
897
|
-
/**
|
|
898
|
-
* Reference to the editor which created the context.
|
|
899
|
-
* Null when the context was created outside of the editor.
|
|
900
|
-
*
|
|
901
|
-
* It is used to destroy the context when removing the editor that has created the context.
|
|
902
|
-
*/
|
|
903
|
-
this._contextOwner = null;
|
|
904
|
-
// We don't pass translations to the config, because its behavior of splitting keys
|
|
905
|
-
// with dots (e.g. `resize.width` => `resize: { width }`) breaks the translations.
|
|
906
|
-
const { translations, ...rest } = config || {};
|
|
907
|
-
this.config = new Config(rest, this.constructor.defaultConfig);
|
|
908
|
-
const availablePlugins = this.constructor.builtinPlugins;
|
|
909
|
-
this.config.define('plugins', availablePlugins);
|
|
910
|
-
this.plugins = new PluginCollection(this, availablePlugins);
|
|
911
|
-
const languageConfig = this.config.get('language') || {};
|
|
912
|
-
this.locale = new Locale({
|
|
913
|
-
uiLanguage: typeof languageConfig === 'string' ? languageConfig : languageConfig.ui,
|
|
914
|
-
contentLanguage: this.config.get('language.content'),
|
|
915
|
-
translations
|
|
916
|
-
});
|
|
917
|
-
this.t = this.locale.t;
|
|
918
|
-
this.editors = new Collection();
|
|
919
|
-
}
|
|
920
|
-
/**
|
|
921
|
-
* Loads and initializes plugins specified in the configuration.
|
|
922
|
-
*
|
|
923
|
-
* @returns A promise which resolves once the initialization is completed, providing an array of loaded plugins.
|
|
924
|
-
*/
|
|
925
|
-
initPlugins() {
|
|
926
|
-
const plugins = this.config.get('plugins') || [];
|
|
927
|
-
const substitutePlugins = this.config.get('substitutePlugins') || [];
|
|
928
|
-
// Plugins for substitution should be checked as well.
|
|
929
|
-
for (const Plugin of plugins.concat(substitutePlugins)) {
|
|
930
|
-
if (typeof Plugin != 'function') {
|
|
931
|
-
/**
|
|
932
|
-
* Only a constructor function is allowed as a {@link module:core/contextplugin~ContextPlugin context plugin}.
|
|
933
|
-
*
|
|
934
|
-
* @error context-initplugins-constructor-only
|
|
935
|
-
*/
|
|
936
|
-
throw new CKEditorError('context-initplugins-constructor-only', null, { Plugin });
|
|
937
|
-
}
|
|
938
|
-
if (Plugin.isContextPlugin !== true) {
|
|
939
|
-
/**
|
|
940
|
-
* Only a plugin marked as a {@link module:core/contextplugin~ContextPlugin.isContextPlugin context plugin}
|
|
941
|
-
* is allowed to be used with a context.
|
|
942
|
-
*
|
|
943
|
-
* @error context-initplugins-invalid-plugin
|
|
944
|
-
*/
|
|
945
|
-
throw new CKEditorError('context-initplugins-invalid-plugin', null, { Plugin });
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
return this.plugins.init(plugins, [], substitutePlugins);
|
|
949
|
-
}
|
|
950
|
-
/**
|
|
951
|
-
* Destroys the context instance and all editors used with the context,
|
|
952
|
-
* releasing all resources used by the context.
|
|
953
|
-
*
|
|
954
|
-
* @returns A promise that resolves once the context instance is fully destroyed.
|
|
955
|
-
*/
|
|
956
|
-
destroy() {
|
|
957
|
-
return Promise.all(Array.from(this.editors, editor => editor.destroy()))
|
|
958
|
-
.then(() => this.plugins.destroy());
|
|
959
|
-
}
|
|
960
|
-
/**
|
|
961
|
-
* Adds a reference to the editor which is used with this context.
|
|
962
|
-
*
|
|
963
|
-
* When the given editor has created the context, the reference to this editor will be stored
|
|
964
|
-
* as a {@link ~Context#_contextOwner}.
|
|
965
|
-
*
|
|
966
|
-
* This method should only be used by the editor.
|
|
967
|
-
*
|
|
968
|
-
* @internal
|
|
969
|
-
* @param isContextOwner Stores the given editor as a context owner.
|
|
970
|
-
*/
|
|
971
|
-
_addEditor(editor, isContextOwner) {
|
|
972
|
-
if (this._contextOwner) {
|
|
973
|
-
/**
|
|
974
|
-
* Cannot add multiple editors to the context which is created by the editor.
|
|
975
|
-
*
|
|
976
|
-
* @error context-addeditor-private-context
|
|
977
|
-
*/
|
|
978
|
-
throw new CKEditorError('context-addeditor-private-context');
|
|
979
|
-
}
|
|
980
|
-
this.editors.add(editor);
|
|
981
|
-
if (isContextOwner) {
|
|
982
|
-
this._contextOwner = editor;
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
/**
|
|
986
|
-
* Removes a reference to the editor which was used with this context.
|
|
987
|
-
* When the context was created by the given editor, the context will be destroyed.
|
|
988
|
-
*
|
|
989
|
-
* This method should only be used by the editor.
|
|
990
|
-
*
|
|
991
|
-
* @internal
|
|
992
|
-
* @return A promise that resolves once the editor is removed from the context or when the context was destroyed.
|
|
993
|
-
*/
|
|
994
|
-
_removeEditor(editor) {
|
|
995
|
-
if (this.editors.has(editor)) {
|
|
996
|
-
this.editors.remove(editor);
|
|
997
|
-
}
|
|
998
|
-
if (this._contextOwner === editor) {
|
|
999
|
-
return this.destroy();
|
|
1000
|
-
}
|
|
1001
|
-
return Promise.resolve();
|
|
1002
|
-
}
|
|
1003
|
-
/**
|
|
1004
|
-
* Returns the context configuration which will be copied to the editors created using this context.
|
|
1005
|
-
*
|
|
1006
|
-
* The configuration returned by this method has the plugins configuration removed – plugins are shared with all editors
|
|
1007
|
-
* through another mechanism.
|
|
1008
|
-
*
|
|
1009
|
-
* This method should only be used by the editor.
|
|
1010
|
-
*
|
|
1011
|
-
* @internal
|
|
1012
|
-
* @returns Configuration as a plain object.
|
|
1013
|
-
*/
|
|
1014
|
-
_getEditorConfig() {
|
|
1015
|
-
const result = {};
|
|
1016
|
-
for (const name of this.config.names()) {
|
|
1017
|
-
if (!['plugins', 'removePlugins', 'extraPlugins'].includes(name)) {
|
|
1018
|
-
result[name] = this.config.get(name);
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
return result;
|
|
1022
|
-
}
|
|
1023
|
-
/**
|
|
1024
|
-
* Creates and initializes a new context instance.
|
|
1025
|
-
*
|
|
1026
|
-
* ```ts
|
|
1027
|
-
* const commonConfig = { ... }; // Configuration for all the plugins and editors.
|
|
1028
|
-
* const editorPlugins = [ ... ]; // Regular plugins here.
|
|
1029
|
-
*
|
|
1030
|
-
* Context
|
|
1031
|
-
* .create( {
|
|
1032
|
-
* // Only context plugins here.
|
|
1033
|
-
* plugins: [ ... ],
|
|
1034
|
-
*
|
|
1035
|
-
* // Configure the language for all the editors (it cannot be overwritten).
|
|
1036
|
-
* language: { ... },
|
|
1037
|
-
*
|
|
1038
|
-
* // Configuration for context plugins.
|
|
1039
|
-
* comments: { ... },
|
|
1040
|
-
* ...
|
|
1041
|
-
*
|
|
1042
|
-
* // Default configuration for editor plugins.
|
|
1043
|
-
* toolbar: { ... },
|
|
1044
|
-
* image: { ... },
|
|
1045
|
-
* ...
|
|
1046
|
-
* } )
|
|
1047
|
-
* .then( context => {
|
|
1048
|
-
* const promises = [];
|
|
1049
|
-
*
|
|
1050
|
-
* promises.push( ClassicEditor.create(
|
|
1051
|
-
* document.getElementById( 'editor1' ),
|
|
1052
|
-
* {
|
|
1053
|
-
* editorPlugins,
|
|
1054
|
-
* context
|
|
1055
|
-
* }
|
|
1056
|
-
* ) );
|
|
1057
|
-
*
|
|
1058
|
-
* promises.push( ClassicEditor.create(
|
|
1059
|
-
* document.getElementById( 'editor2' ),
|
|
1060
|
-
* {
|
|
1061
|
-
* editorPlugins,
|
|
1062
|
-
* context,
|
|
1063
|
-
* toolbar: { ... } // You can overwrite the configuration of the context.
|
|
1064
|
-
* }
|
|
1065
|
-
* ) );
|
|
1066
|
-
*
|
|
1067
|
-
* return Promise.all( promises );
|
|
1068
|
-
* } );
|
|
1069
|
-
* ```
|
|
1070
|
-
*
|
|
1071
|
-
* @param config The context configuration.
|
|
1072
|
-
* @returns A promise resolved once the context is ready. The promise resolves with the created context instance.
|
|
1073
|
-
*/
|
|
1074
|
-
static create(config) {
|
|
1075
|
-
return new Promise(resolve => {
|
|
1076
|
-
const context = new this(config);
|
|
1077
|
-
resolve(context.initPlugins().then(() => context));
|
|
1078
|
-
});
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
/**
|
|
1083
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1084
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1085
|
-
*/
|
|
1086
|
-
/**
|
|
1087
|
-
* @module core/contextplugin
|
|
1088
|
-
*/
|
|
1089
|
-
/**
|
|
1090
|
-
* The base class for {@link module:core/context~Context} plugin classes.
|
|
1091
|
-
*
|
|
1092
|
-
* A context plugin can either be initialized for an {@link module:core/editor/editor~Editor editor} or for
|
|
1093
|
-
* a {@link module:core/context~Context context}. In other words, it can either
|
|
1094
|
-
* work within one editor instance or with one or more editor instances that use a single context.
|
|
1095
|
-
* It is the context plugin's role to implement handling for both modes.
|
|
1096
|
-
*
|
|
1097
|
-
* There are a few rules for interaction between the editor plugins and context plugins:
|
|
1098
|
-
*
|
|
1099
|
-
* * A context plugin can require another context plugin.
|
|
1100
|
-
* * An {@link module:core/plugin~Plugin editor plugin} can require a context plugin.
|
|
1101
|
-
* * A context plugin MUST NOT require an {@link module:core/plugin~Plugin editor plugin}.
|
|
1102
|
-
*/
|
|
1103
|
-
class ContextPlugin extends ObservableMixin() {
|
|
1104
|
-
/**
|
|
1105
|
-
* Creates a new plugin instance.
|
|
1106
|
-
*/
|
|
1107
|
-
constructor(context) {
|
|
1108
|
-
super();
|
|
1109
|
-
this.context = context;
|
|
1110
|
-
}
|
|
1111
|
-
/**
|
|
1112
|
-
* @inheritDoc
|
|
1113
|
-
*/
|
|
1114
|
-
destroy() {
|
|
1115
|
-
this.stopListening();
|
|
1116
|
-
}
|
|
1117
|
-
/**
|
|
1118
|
-
* @inheritDoc
|
|
1119
|
-
*/
|
|
1120
|
-
static get isContextPlugin() {
|
|
1121
|
-
return true;
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
/**
|
|
1126
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1127
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1128
|
-
*/
|
|
1129
|
-
/**
|
|
1130
|
-
* @module core/commandcollection
|
|
1131
|
-
*/
|
|
1132
|
-
/**
|
|
1133
|
-
* Collection of commands. Its instance is available in {@link module:core/editor/editor~Editor#commands `editor.commands`}.
|
|
1134
|
-
*/
|
|
1135
|
-
class CommandCollection {
|
|
1136
|
-
/**
|
|
1137
|
-
* Creates collection instance.
|
|
1138
|
-
*/
|
|
1139
|
-
constructor() {
|
|
1140
|
-
this._commands = new Map();
|
|
1141
|
-
}
|
|
1142
|
-
/**
|
|
1143
|
-
* Registers a new command.
|
|
1144
|
-
*
|
|
1145
|
-
* @param commandName The name of the command.
|
|
1146
|
-
*/
|
|
1147
|
-
add(commandName, command) {
|
|
1148
|
-
this._commands.set(commandName, command);
|
|
1149
|
-
}
|
|
1150
|
-
/**
|
|
1151
|
-
* Retrieves a command from the collection.
|
|
1152
|
-
*
|
|
1153
|
-
* @param commandName The name of the command.
|
|
1154
|
-
*/
|
|
1155
|
-
get(commandName) {
|
|
1156
|
-
return this._commands.get(commandName);
|
|
1157
|
-
}
|
|
1158
|
-
/**
|
|
1159
|
-
* Executes a command.
|
|
1160
|
-
*
|
|
1161
|
-
* @param commandName The name of the command.
|
|
1162
|
-
* @param commandParams Command parameters.
|
|
1163
|
-
* @returns The value returned by the {@link module:core/command~Command#execute `command.execute()`}.
|
|
1164
|
-
*/
|
|
1165
|
-
execute(commandName, ...commandParams) {
|
|
1166
|
-
const command = this.get(commandName);
|
|
1167
|
-
if (!command) {
|
|
1168
|
-
/**
|
|
1169
|
-
* Command does not exist.
|
|
1170
|
-
*
|
|
1171
|
-
* @error commandcollection-command-not-found
|
|
1172
|
-
* @param commandName Name of the command.
|
|
1173
|
-
*/
|
|
1174
|
-
throw new CKEditorError('commandcollection-command-not-found', this, { commandName });
|
|
1175
|
-
}
|
|
1176
|
-
return command.execute(...commandParams);
|
|
1177
|
-
}
|
|
1178
|
-
/**
|
|
1179
|
-
* Returns iterator of command names.
|
|
1180
|
-
*/
|
|
1181
|
-
*names() {
|
|
1182
|
-
yield* this._commands.keys();
|
|
1183
|
-
}
|
|
1184
|
-
/**
|
|
1185
|
-
* Returns iterator of command instances.
|
|
1186
|
-
*/
|
|
1187
|
-
*commands() {
|
|
1188
|
-
yield* this._commands.values();
|
|
1189
|
-
}
|
|
1190
|
-
/**
|
|
1191
|
-
* Iterable interface.
|
|
1192
|
-
*
|
|
1193
|
-
* Returns `[ commandName, commandInstance ]` pairs.
|
|
1194
|
-
*/
|
|
1195
|
-
[Symbol.iterator]() {
|
|
1196
|
-
return this._commands[Symbol.iterator]();
|
|
1197
|
-
}
|
|
1198
|
-
/**
|
|
1199
|
-
* Destroys all collection commands.
|
|
1200
|
-
*/
|
|
1201
|
-
destroy() {
|
|
1202
|
-
for (const command of this.commands()) {
|
|
1203
|
-
command.destroy();
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
/**
|
|
1209
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1210
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1211
|
-
*/
|
|
1212
|
-
/**
|
|
1213
|
-
* @module core/editingkeystrokehandler
|
|
1214
|
-
*/
|
|
1215
|
-
/**
|
|
1216
|
-
* A keystroke handler for editor editing. Its instance is available
|
|
1217
|
-
* in {@link module:core/editor/editor~Editor#keystrokes} so plugins
|
|
1218
|
-
* can register their keystrokes.
|
|
1219
|
-
*
|
|
1220
|
-
* E.g. an undo plugin would do this:
|
|
1221
|
-
*
|
|
1222
|
-
* ```ts
|
|
1223
|
-
* editor.keystrokes.set( 'Ctrl+Z', 'undo' );
|
|
1224
|
-
* editor.keystrokes.set( 'Ctrl+Shift+Z', 'redo' );
|
|
1225
|
-
* editor.keystrokes.set( 'Ctrl+Y', 'redo' );
|
|
1226
|
-
* ```
|
|
1227
|
-
*/
|
|
1228
|
-
class EditingKeystrokeHandler extends KeystrokeHandler {
|
|
1229
|
-
/**
|
|
1230
|
-
* Creates an instance of the keystroke handler.
|
|
1231
|
-
*/
|
|
1232
|
-
constructor(editor) {
|
|
1233
|
-
super();
|
|
1234
|
-
this.editor = editor;
|
|
1235
|
-
}
|
|
1236
|
-
/**
|
|
1237
|
-
* Registers a handler for the specified keystroke.
|
|
1238
|
-
*
|
|
1239
|
-
* The handler can be specified as a command name or a callback.
|
|
1240
|
-
*
|
|
1241
|
-
* @param keystroke Keystroke defined in a format accepted by
|
|
1242
|
-
* the {@link module:utils/keyboard~parseKeystroke} function.
|
|
1243
|
-
* @param callback If a string is passed, then the keystroke will
|
|
1244
|
-
* {@link module:core/editor/editor~Editor#execute execute a command}.
|
|
1245
|
-
* If a function, then it will be called with the
|
|
1246
|
-
* {@link module:engine/view/observer/keyobserver~KeyEventData key event data} object and
|
|
1247
|
-
* a `cancel()` helper to both `preventDefault()` and `stopPropagation()` of the event.
|
|
1248
|
-
* @param options Additional options.
|
|
1249
|
-
* @param options.priority The priority of the keystroke callback. The higher the priority value
|
|
1250
|
-
* the sooner the callback will be executed. Keystrokes having the same priority
|
|
1251
|
-
* are called in the order they were added.
|
|
1252
|
-
*/
|
|
1253
|
-
set(keystroke, callback, options = {}) {
|
|
1254
|
-
if (typeof callback == 'string') {
|
|
1255
|
-
const commandName = callback;
|
|
1256
|
-
callback = (evtData, cancel) => {
|
|
1257
|
-
this.editor.execute(commandName);
|
|
1258
|
-
cancel();
|
|
1259
|
-
};
|
|
1260
|
-
}
|
|
1261
|
-
super.set(keystroke, callback, options);
|
|
1262
|
-
}
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
/**
|
|
1266
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1267
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1268
|
-
*/
|
|
1269
|
-
/**
|
|
1270
|
-
* @module core/accessibility
|
|
1271
|
-
*/
|
|
1272
|
-
const DEFAULT_CATEGORY_ID = 'contentEditing';
|
|
1273
|
-
const DEFAULT_GROUP_ID = 'common';
|
|
1274
|
-
/**
|
|
1275
|
-
* A common namespace for various accessibility features of the editor.
|
|
1276
|
-
*
|
|
1277
|
-
* **Information about editor keystrokes**
|
|
1278
|
-
*
|
|
1279
|
-
* * The information about keystrokes available in the editor is stored in the {@link #keystrokeInfos} property.
|
|
1280
|
-
* * New info entries can be added using the {@link #addKeystrokeInfoCategory}, {@link #addKeystrokeInfoGroup},
|
|
1281
|
-
* and {@link #addKeystrokeInfos} methods.
|
|
1282
|
-
*/
|
|
1283
|
-
class Accessibility {
|
|
1284
|
-
/**
|
|
1285
|
-
* @inheritDoc
|
|
1286
|
-
*/
|
|
1287
|
-
constructor(editor) {
|
|
1288
|
-
/**
|
|
1289
|
-
* Stores information about keystrokes brought by editor features for the users to interact with the editor, mainly
|
|
1290
|
-
* keystroke combinations and their accessible labels.
|
|
1291
|
-
*
|
|
1292
|
-
* This information is particularly useful for screen reader and other assistive technology users. It gets displayed
|
|
1293
|
-
* by the {@link module:ui/editorui/accessibilityhelp/accessibilityhelp~AccessibilityHelp Accessibility help} dialog.
|
|
1294
|
-
*
|
|
1295
|
-
* Keystrokes are organized in categories and groups. They can be added using ({@link #addKeystrokeInfoCategory},
|
|
1296
|
-
* {@link #addKeystrokeInfoGroup}, and {@link #addKeystrokeInfos}) methods.
|
|
1297
|
-
*
|
|
1298
|
-
* Please note that:
|
|
1299
|
-
* * two categories are always available:
|
|
1300
|
-
* * `'contentEditing'` for keystrokes related to content creation,
|
|
1301
|
-
* * `'navigation'` for keystrokes related to navigation in the UI and the content.
|
|
1302
|
-
* * unless specified otherwise, new keystrokes are added into the `'contentEditing'` category and the `'common'`
|
|
1303
|
-
* keystroke group within that category while using the {@link #addKeystrokeInfos} method.
|
|
1304
|
-
*/
|
|
1305
|
-
this.keystrokeInfos = new Map();
|
|
1306
|
-
this._editor = editor;
|
|
1307
|
-
const t = editor.locale.t;
|
|
1308
|
-
this.addKeystrokeInfoCategory({
|
|
1309
|
-
id: DEFAULT_CATEGORY_ID,
|
|
1310
|
-
label: t('Content editing keystrokes'),
|
|
1311
|
-
description: t('These keyboard shortcuts allow for quick access to content editing features.')
|
|
1312
|
-
});
|
|
1313
|
-
this.addKeystrokeInfoCategory({
|
|
1314
|
-
id: 'navigation',
|
|
1315
|
-
label: t('User interface and content navigation keystrokes'),
|
|
1316
|
-
description: t('Use the following keystrokes for more efficient navigation in the CKEditor 5 user interface.'),
|
|
1317
|
-
groups: [
|
|
1318
|
-
{
|
|
1319
|
-
id: 'common',
|
|
1320
|
-
keystrokes: [
|
|
1321
|
-
{
|
|
1322
|
-
label: t('Close contextual balloons, dropdowns, and dialogs'),
|
|
1323
|
-
keystroke: 'Esc'
|
|
1324
|
-
},
|
|
1325
|
-
{
|
|
1326
|
-
label: t('Open the accessibility help dialog'),
|
|
1327
|
-
keystroke: 'Alt+0'
|
|
1328
|
-
},
|
|
1329
|
-
{
|
|
1330
|
-
label: t('Move focus between form fields (inputs, buttons, etc.)'),
|
|
1331
|
-
keystroke: [['Tab'], ['Shift+Tab']]
|
|
1332
|
-
},
|
|
1333
|
-
{
|
|
1334
|
-
label: t('Move focus to the toolbar, navigate between toolbars'),
|
|
1335
|
-
keystroke: 'Alt+F10',
|
|
1336
|
-
mayRequireFn: true
|
|
1337
|
-
},
|
|
1338
|
-
{
|
|
1339
|
-
label: t('Navigate through the toolbar'),
|
|
1340
|
-
keystroke: [['arrowup'], ['arrowright'], ['arrowdown'], ['arrowleft']]
|
|
1341
|
-
},
|
|
1342
|
-
{
|
|
1343
|
-
label: t('Execute the currently focused button'),
|
|
1344
|
-
keystroke: [['Enter'], ['Space']]
|
|
1345
|
-
}
|
|
1346
|
-
]
|
|
1347
|
-
}
|
|
1348
|
-
]
|
|
1349
|
-
});
|
|
1350
|
-
}
|
|
1351
|
-
/**
|
|
1352
|
-
* Adds a top-level category in the {@link #keystrokeInfos keystroke information database} with a label and optional description.
|
|
1353
|
-
*
|
|
1354
|
-
* Categories organize keystrokes and help users to find the right keystroke. Each category can have multiple groups
|
|
1355
|
-
* of keystrokes that narrow down the context in which the keystrokes are available. Every keystroke category comes
|
|
1356
|
-
* with a `'common'` group by default.
|
|
1357
|
-
*
|
|
1358
|
-
* By default, two categories are available:
|
|
1359
|
-
* * `'contentEditing'` for keystrokes related to content creation,
|
|
1360
|
-
* * `'navigation'` for keystrokes related to navigation in the UI and the content.
|
|
1361
|
-
*
|
|
1362
|
-
* To create a new keystroke category with new groups, use the following code:
|
|
1363
|
-
*
|
|
1364
|
-
* ```js
|
|
1365
|
-
* class MyPlugin extends Plugin {
|
|
1366
|
-
* // ...
|
|
1367
|
-
* init() {
|
|
1368
|
-
* const editor = this.editor;
|
|
1369
|
-
* const t = editor.t;
|
|
1370
|
-
*
|
|
1371
|
-
* // ...
|
|
1372
|
-
*
|
|
1373
|
-
* editor.accessibility.addKeystrokeInfoCategory( {
|
|
1374
|
-
* id: 'myCategory',
|
|
1375
|
-
* label: t( 'My category' ),
|
|
1376
|
-
* description: t( 'My category description.' ),
|
|
1377
|
-
* groups: [
|
|
1378
|
-
* {
|
|
1379
|
-
* id: 'myGroup',
|
|
1380
|
-
* label: t( 'My keystroke group' ),
|
|
1381
|
-
* keystrokes: [
|
|
1382
|
-
* {
|
|
1383
|
-
* label: t( 'Keystroke label 1' ),
|
|
1384
|
-
* keystroke: 'Ctrl+Shift+N'
|
|
1385
|
-
* },
|
|
1386
|
-
* {
|
|
1387
|
-
* label: t( 'Keystroke label 2' ),
|
|
1388
|
-
* keystroke: 'Ctrl+Shift+M'
|
|
1389
|
-
* }
|
|
1390
|
-
* ]
|
|
1391
|
-
* }
|
|
1392
|
-
* ]
|
|
1393
|
-
* };
|
|
1394
|
-
* }
|
|
1395
|
-
* }
|
|
1396
|
-
* ```
|
|
1397
|
-
*
|
|
1398
|
-
* See {@link #keystrokeInfos}, {@link #addKeystrokeInfoGroup}, and {@link #addKeystrokeInfos}.
|
|
1399
|
-
*/
|
|
1400
|
-
addKeystrokeInfoCategory({ id, label, description, groups }) {
|
|
1401
|
-
this.keystrokeInfos.set(id, {
|
|
1402
|
-
id,
|
|
1403
|
-
label,
|
|
1404
|
-
description,
|
|
1405
|
-
groups: new Map()
|
|
1406
|
-
});
|
|
1407
|
-
this.addKeystrokeInfoGroup({
|
|
1408
|
-
categoryId: id,
|
|
1409
|
-
id: DEFAULT_GROUP_ID
|
|
1410
|
-
});
|
|
1411
|
-
if (groups) {
|
|
1412
|
-
groups.forEach(group => {
|
|
1413
|
-
this.addKeystrokeInfoGroup({
|
|
1414
|
-
categoryId: id,
|
|
1415
|
-
...group
|
|
1416
|
-
});
|
|
1417
|
-
});
|
|
1418
|
-
}
|
|
1419
|
-
}
|
|
1420
|
-
/**
|
|
1421
|
-
* Adds a group of keystrokes in a specific category to the {@link #keystrokeInfos keystroke information database}.
|
|
1422
|
-
*
|
|
1423
|
-
* Groups narrow down the context in which the keystrokes are available. When `categoryId` is not specified,
|
|
1424
|
-
* the group goes to the `'contentEditing'` category (default).
|
|
1425
|
-
*
|
|
1426
|
-
* To create a new group within an existing category, use the following code:
|
|
1427
|
-
*
|
|
1428
|
-
* ```js
|
|
1429
|
-
* class MyPlugin extends Plugin {
|
|
1430
|
-
* // ...
|
|
1431
|
-
* init() {
|
|
1432
|
-
* const editor = this.editor;
|
|
1433
|
-
* const t = editor.t;
|
|
1434
|
-
*
|
|
1435
|
-
* // ...
|
|
1436
|
-
*
|
|
1437
|
-
* editor.accessibility.addKeystrokeInfoGroup( {
|
|
1438
|
-
* id: 'myGroup',
|
|
1439
|
-
* categoryId: 'navigation',
|
|
1440
|
-
* label: t( 'My keystroke group' ),
|
|
1441
|
-
* keystrokes: [
|
|
1442
|
-
* {
|
|
1443
|
-
* label: t( 'Keystroke label 1' ),
|
|
1444
|
-
* keystroke: 'Ctrl+Shift+N'
|
|
1445
|
-
* },
|
|
1446
|
-
* {
|
|
1447
|
-
* label: t( 'Keystroke label 2' ),
|
|
1448
|
-
* keystroke: 'Ctrl+Shift+M'
|
|
1449
|
-
* }
|
|
1450
|
-
* ]
|
|
1451
|
-
* } );
|
|
1452
|
-
* }
|
|
1453
|
-
* }
|
|
1454
|
-
* ```
|
|
1455
|
-
*
|
|
1456
|
-
* See {@link #keystrokeInfos}, {@link #addKeystrokeInfoCategory}, and {@link #addKeystrokeInfos}.
|
|
1457
|
-
*/
|
|
1458
|
-
addKeystrokeInfoGroup({ categoryId = DEFAULT_CATEGORY_ID, id, label, keystrokes }) {
|
|
1459
|
-
const category = this.keystrokeInfos.get(categoryId);
|
|
1460
|
-
if (!category) {
|
|
1461
|
-
throw new CKEditorError('accessibility-unknown-keystroke-info-category', this._editor, { groupId: id, categoryId });
|
|
1462
|
-
}
|
|
1463
|
-
category.groups.set(id, {
|
|
1464
|
-
id,
|
|
1465
|
-
label,
|
|
1466
|
-
keystrokes: keystrokes || []
|
|
1467
|
-
});
|
|
1468
|
-
}
|
|
1469
|
-
/**
|
|
1470
|
-
* Adds information about keystrokes to the {@link #keystrokeInfos keystroke information database}.
|
|
1471
|
-
*
|
|
1472
|
-
* Keystrokes without specified `groupId` or `categoryId` go to the `'common'` group in the `'contentEditing'` category (default).
|
|
1473
|
-
*
|
|
1474
|
-
* To add a keystroke brought by your plugin (using default group and category), use the following code:
|
|
1475
|
-
*
|
|
1476
|
-
* ```js
|
|
1477
|
-
* class MyPlugin extends Plugin {
|
|
1478
|
-
* // ...
|
|
1479
|
-
* init() {
|
|
1480
|
-
* const editor = this.editor;
|
|
1481
|
-
* const t = editor.t;
|
|
1482
|
-
*
|
|
1483
|
-
* // ...
|
|
1484
|
-
*
|
|
1485
|
-
* editor.accessibility.addKeystrokeInfos( {
|
|
1486
|
-
* keystrokes: [
|
|
1487
|
-
* {
|
|
1488
|
-
* label: t( 'Keystroke label' ),
|
|
1489
|
-
* keystroke: 'CTRL+B'
|
|
1490
|
-
* }
|
|
1491
|
-
* ]
|
|
1492
|
-
* } );
|
|
1493
|
-
* }
|
|
1494
|
-
* }
|
|
1495
|
-
* ```
|
|
1496
|
-
* To add a keystroke in a specific existing `'widget'` group in the default `'contentEditing'` category:
|
|
1497
|
-
*
|
|
1498
|
-
* ```js
|
|
1499
|
-
* class MyPlugin extends Plugin {
|
|
1500
|
-
* // ...
|
|
1501
|
-
* init() {
|
|
1502
|
-
* const editor = this.editor;
|
|
1503
|
-
* const t = editor.t;
|
|
1504
|
-
*
|
|
1505
|
-
* // ...
|
|
1506
|
-
*
|
|
1507
|
-
* editor.accessibility.addKeystrokeInfos( {
|
|
1508
|
-
* // Add a keystroke to the existing "widget" group.
|
|
1509
|
-
* groupId: 'widget',
|
|
1510
|
-
* keystrokes: [
|
|
1511
|
-
* {
|
|
1512
|
-
* label: t( 'A an action on a selected widget' ),
|
|
1513
|
-
* keystroke: 'Ctrl+D',
|
|
1514
|
-
* }
|
|
1515
|
-
* ]
|
|
1516
|
-
* } );
|
|
1517
|
-
* }
|
|
1518
|
-
* }
|
|
1519
|
-
* ```
|
|
1520
|
-
*
|
|
1521
|
-
* To add a keystroke to another existing category (using default group):
|
|
1522
|
-
*
|
|
1523
|
-
* ```js
|
|
1524
|
-
* class MyPlugin extends Plugin {
|
|
1525
|
-
* // ...
|
|
1526
|
-
* init() {
|
|
1527
|
-
* const editor = this.editor;
|
|
1528
|
-
* const t = editor.t;
|
|
1529
|
-
*
|
|
1530
|
-
* // ...
|
|
1531
|
-
*
|
|
1532
|
-
* editor.accessibility.addKeystrokeInfos( {
|
|
1533
|
-
* // Add keystrokes to the "navigation" category (one of defaults).
|
|
1534
|
-
* categoryId: 'navigation',
|
|
1535
|
-
* keystrokes: [
|
|
1536
|
-
* {
|
|
1537
|
-
* label: t( 'Keystroke label' ),
|
|
1538
|
-
* keystroke: 'CTRL+B'
|
|
1539
|
-
* }
|
|
1540
|
-
* ]
|
|
1541
|
-
* } );
|
|
1542
|
-
* }
|
|
1543
|
-
* }
|
|
1544
|
-
* ```
|
|
1545
|
-
*
|
|
1546
|
-
* See {@link #keystrokeInfos}, {@link #addKeystrokeInfoGroup}, and {@link #addKeystrokeInfoCategory}.
|
|
1547
|
-
*/
|
|
1548
|
-
addKeystrokeInfos({ categoryId = DEFAULT_CATEGORY_ID, groupId = DEFAULT_GROUP_ID, keystrokes }) {
|
|
1549
|
-
if (!this.keystrokeInfos.has(categoryId)) {
|
|
1550
|
-
/**
|
|
1551
|
-
* Cannot add keystrokes in an unknown category. Use
|
|
1552
|
-
* {@link module:core/accessibility~Accessibility#addKeystrokeInfoCategory}
|
|
1553
|
-
* to add a new category or make sure the specified category exists.
|
|
1554
|
-
*
|
|
1555
|
-
* @error accessibility-unknown-keystroke-info-category
|
|
1556
|
-
* @param categoryId The id of the unknown keystroke category.
|
|
1557
|
-
* @param keystrokes Keystroke definitions about to be added.
|
|
1558
|
-
*/
|
|
1559
|
-
throw new CKEditorError('accessibility-unknown-keystroke-info-category', this._editor, { categoryId, keystrokes });
|
|
1560
|
-
}
|
|
1561
|
-
const category = this.keystrokeInfos.get(categoryId);
|
|
1562
|
-
if (!category.groups.has(groupId)) {
|
|
1563
|
-
/**
|
|
1564
|
-
* Cannot add keystrokes to an unknown group.
|
|
1565
|
-
*
|
|
1566
|
-
* Use {@link module:core/accessibility~Accessibility#addKeystrokeInfoGroup}
|
|
1567
|
-
* to add a new group or make sure the specified group exists.
|
|
1568
|
-
*
|
|
1569
|
-
* @error accessibility-unknown-keystroke-info-group
|
|
1570
|
-
* @param groupId The id of the unknown keystroke group.
|
|
1571
|
-
* @param categoryId The id of category the unknown group should belong to.
|
|
1572
|
-
* @param keystrokes Keystroke definitions about to be added.
|
|
1573
|
-
*/
|
|
1574
|
-
throw new CKEditorError('accessibility-unknown-keystroke-info-group', this._editor, { groupId, categoryId, keystrokes });
|
|
1575
|
-
}
|
|
1576
|
-
category.groups.get(groupId).keystrokes.push(...keystrokes);
|
|
1577
|
-
}
|
|
1578
|
-
}
|
|
1579
|
-
|
|
1580
|
-
/**
|
|
1581
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1582
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1583
|
-
*/
|
|
1584
|
-
/**
|
|
1585
|
-
* @module core/editor/editor
|
|
1586
|
-
*/
|
|
1587
|
-
/**
|
|
1588
|
-
* The class representing a basic, generic editor.
|
|
1589
|
-
*
|
|
1590
|
-
* Check out the list of its subclasses to learn about specific editor implementations.
|
|
1591
|
-
*
|
|
1592
|
-
* All editor implementations (like {@link module:editor-classic/classiceditor~ClassicEditor} or
|
|
1593
|
-
* {@link module:editor-inline/inlineeditor~InlineEditor}) should extend this class. They can add their
|
|
1594
|
-
* own methods and properties.
|
|
1595
|
-
*
|
|
1596
|
-
* When you are implementing a plugin, this editor represents the API
|
|
1597
|
-
* which your plugin can expect to get when using its {@link module:core/plugin~Plugin#editor} property.
|
|
1598
|
-
*
|
|
1599
|
-
* This API should be sufficient in order to implement the "editing" part of your feature
|
|
1600
|
-
* (schema definition, conversion, commands, keystrokes, etc.).
|
|
1601
|
-
* It does not define the editor UI, which is available only if
|
|
1602
|
-
* the specific editor implements also the {@link ~Editor#ui} property
|
|
1603
|
-
* (as most editor implementations do).
|
|
1604
|
-
*/
|
|
1605
|
-
class Editor extends ObservableMixin() {
|
|
1606
|
-
/**
|
|
1607
|
-
* Creates a new instance of the editor class.
|
|
1608
|
-
*
|
|
1609
|
-
* Usually, not to be used directly. See the static {@link module:core/editor/editor~Editor.create `create()`} method.
|
|
1610
|
-
*
|
|
1611
|
-
* @param config The editor configuration.
|
|
1612
|
-
*/
|
|
1613
|
-
constructor(config = {}) {
|
|
1614
|
-
super();
|
|
1615
|
-
const constructor = this.constructor;
|
|
1616
|
-
// We don't pass translations to the config, because its behavior of splitting keys
|
|
1617
|
-
// with dots (e.g. `resize.width` => `resize: { width }`) breaks the translations.
|
|
1618
|
-
const { translations: defaultTranslations, ...defaultConfig } = constructor.defaultConfig || {};
|
|
1619
|
-
const { translations = defaultTranslations, ...rest } = config;
|
|
1620
|
-
// Prefer the language passed as the argument to the constructor instead of the constructor's `defaultConfig`, if both are set.
|
|
1621
|
-
const language = config.language || defaultConfig.language;
|
|
1622
|
-
this._context = config.context || new Context({ language, translations });
|
|
1623
|
-
this._context._addEditor(this, !config.context);
|
|
1624
|
-
// Clone the plugins to make sure that the plugin array will not be shared
|
|
1625
|
-
// between editors and make the watchdog feature work correctly.
|
|
1626
|
-
const availablePlugins = Array.from(constructor.builtinPlugins || []);
|
|
1627
|
-
this.config = new Config(rest, defaultConfig);
|
|
1628
|
-
this.config.define('plugins', availablePlugins);
|
|
1629
|
-
this.config.define(this._context._getEditorConfig());
|
|
1630
|
-
this.plugins = new PluginCollection(this, availablePlugins, this._context.plugins);
|
|
1631
|
-
this.locale = this._context.locale;
|
|
1632
|
-
this.t = this.locale.t;
|
|
1633
|
-
this._readOnlyLocks = new Set();
|
|
1634
|
-
this.commands = new CommandCollection();
|
|
1635
|
-
this.set('state', 'initializing');
|
|
1636
|
-
this.once('ready', () => (this.state = 'ready'), { priority: 'high' });
|
|
1637
|
-
this.once('destroy', () => (this.state = 'destroyed'), { priority: 'high' });
|
|
1638
|
-
this.model = new Model();
|
|
1639
|
-
this.on('change:isReadOnly', () => {
|
|
1640
|
-
this.model.document.isReadOnly = this.isReadOnly;
|
|
1641
|
-
});
|
|
1642
|
-
const stylesProcessor = new StylesProcessor();
|
|
1643
|
-
this.data = new DataController(this.model, stylesProcessor);
|
|
1644
|
-
this.editing = new EditingController(this.model, stylesProcessor);
|
|
1645
|
-
this.editing.view.document.bind('isReadOnly').to(this);
|
|
1646
|
-
this.conversion = new Conversion([this.editing.downcastDispatcher, this.data.downcastDispatcher], this.data.upcastDispatcher);
|
|
1647
|
-
this.conversion.addAlias('dataDowncast', this.data.downcastDispatcher);
|
|
1648
|
-
this.conversion.addAlias('editingDowncast', this.editing.downcastDispatcher);
|
|
1649
|
-
this.keystrokes = new EditingKeystrokeHandler(this);
|
|
1650
|
-
this.keystrokes.listenTo(this.editing.view.document);
|
|
1651
|
-
this.accessibility = new Accessibility(this);
|
|
1652
|
-
}
|
|
1653
|
-
/**
|
|
1654
|
-
* Defines whether the editor is in the read-only mode.
|
|
1655
|
-
*
|
|
1656
|
-
* In read-only mode the editor {@link #commands commands} are disabled so it is not possible
|
|
1657
|
-
* to modify the document by using them. Also, the editable element(s) become non-editable.
|
|
1658
|
-
*
|
|
1659
|
-
* In order to make the editor read-only, you need to call the {@link #enableReadOnlyMode} method:
|
|
1660
|
-
*
|
|
1661
|
-
* ```ts
|
|
1662
|
-
* editor.enableReadOnlyMode( 'feature-id' );
|
|
1663
|
-
* ```
|
|
1664
|
-
*
|
|
1665
|
-
* Later, to turn off the read-only mode, call {@link #disableReadOnlyMode}:
|
|
1666
|
-
*
|
|
1667
|
-
* ```ts
|
|
1668
|
-
* editor.disableReadOnlyMode( 'feature-id' );
|
|
1669
|
-
* ```
|
|
1670
|
-
*
|
|
1671
|
-
* @readonly
|
|
1672
|
-
* @observable
|
|
1673
|
-
*/
|
|
1674
|
-
get isReadOnly() {
|
|
1675
|
-
return this._readOnlyLocks.size > 0;
|
|
1676
|
-
}
|
|
1677
|
-
set isReadOnly(value) {
|
|
1678
|
-
/**
|
|
1679
|
-
* The {@link module:core/editor/editor~Editor#isReadOnly Editor#isReadOnly} property is read-only since version `34.0.0`
|
|
1680
|
-
* and can be set only using {@link module:core/editor/editor~Editor#enableReadOnlyMode `Editor#enableReadOnlyMode( lockId )`} and
|
|
1681
|
-
* {@link module:core/editor/editor~Editor#disableReadOnlyMode `Editor#disableReadOnlyMode( lockId )`}.
|
|
1682
|
-
*
|
|
1683
|
-
* Usage before version `34.0.0`:
|
|
1684
|
-
*
|
|
1685
|
-
* ```ts
|
|
1686
|
-
* editor.isReadOnly = true;
|
|
1687
|
-
* editor.isReadOnly = false;
|
|
1688
|
-
* ```
|
|
1689
|
-
*
|
|
1690
|
-
* Usage since version `34.0.0`:
|
|
1691
|
-
*
|
|
1692
|
-
* ```ts
|
|
1693
|
-
* editor.enableReadOnlyMode( 'my-feature-id' );
|
|
1694
|
-
* editor.disableReadOnlyMode( 'my-feature-id' );
|
|
1695
|
-
* ```
|
|
1696
|
-
*
|
|
1697
|
-
* @error editor-isreadonly-has-no-setter
|
|
1698
|
-
*/
|
|
1699
|
-
throw new CKEditorError('editor-isreadonly-has-no-setter');
|
|
1700
|
-
}
|
|
1701
|
-
/**
|
|
1702
|
-
* Turns on the read-only mode in the editor.
|
|
1703
|
-
*
|
|
1704
|
-
* Editor can be switched to or out of the read-only mode by many features, under various circumstances. The editor supports locking
|
|
1705
|
-
* mechanism for the read-only mode. It enables easy control over the read-only mode when many features wants to turn it on or off at
|
|
1706
|
-
* the same time, without conflicting with each other. It guarantees that you will not make the editor editable accidentally (which
|
|
1707
|
-
* could lead to errors).
|
|
1708
|
-
*
|
|
1709
|
-
* Each read-only mode request is identified by a unique id (also called "lock"). If multiple plugins requested to turn on the
|
|
1710
|
-
* read-only mode, then, the editor will become editable only after all these plugins turn the read-only mode off (using the same ids).
|
|
1711
|
-
*
|
|
1712
|
-
* Note, that you cannot force the editor to disable the read-only mode if other plugins set it.
|
|
1713
|
-
*
|
|
1714
|
-
* After the first `enableReadOnlyMode()` call, the {@link #isReadOnly `isReadOnly` property} will be set to `true`:
|
|
1715
|
-
*
|
|
1716
|
-
* ```ts
|
|
1717
|
-
* editor.isReadOnly; // `false`.
|
|
1718
|
-
* editor.enableReadOnlyMode( 'my-feature-id' );
|
|
1719
|
-
* editor.isReadOnly; // `true`.
|
|
1720
|
-
* ```
|
|
1721
|
-
*
|
|
1722
|
-
* You can turn off the read-only mode ("clear the lock") using the {@link #disableReadOnlyMode `disableReadOnlyMode()`} method:
|
|
1723
|
-
*
|
|
1724
|
-
* ```ts
|
|
1725
|
-
* editor.enableReadOnlyMode( 'my-feature-id' );
|
|
1726
|
-
* // ...
|
|
1727
|
-
* editor.disableReadOnlyMode( 'my-feature-id' );
|
|
1728
|
-
* editor.isReadOnly; // `false`.
|
|
1729
|
-
* ```
|
|
1730
|
-
*
|
|
1731
|
-
* All "locks" need to be removed to enable editing:
|
|
1732
|
-
*
|
|
1733
|
-
* ```ts
|
|
1734
|
-
* editor.enableReadOnlyMode( 'my-feature-id' );
|
|
1735
|
-
* editor.enableReadOnlyMode( 'my-other-feature-id' );
|
|
1736
|
-
* // ...
|
|
1737
|
-
* editor.disableReadOnlyMode( 'my-feature-id' );
|
|
1738
|
-
* editor.isReadOnly; // `true`.
|
|
1739
|
-
* editor.disableReadOnlyMode( 'my-other-feature-id' );
|
|
1740
|
-
* editor.isReadOnly; // `false`.
|
|
1741
|
-
* ```
|
|
1742
|
-
*
|
|
1743
|
-
* @param lockId A unique ID for setting the editor to the read-only state.
|
|
1744
|
-
*/
|
|
1745
|
-
enableReadOnlyMode(lockId) {
|
|
1746
|
-
if (typeof lockId !== 'string' && typeof lockId !== 'symbol') {
|
|
1747
|
-
/**
|
|
1748
|
-
* The lock ID is missing or it is not a string or symbol.
|
|
1749
|
-
*
|
|
1750
|
-
* @error editor-read-only-lock-id-invalid
|
|
1751
|
-
*/
|
|
1752
|
-
throw new CKEditorError('editor-read-only-lock-id-invalid', null, { lockId });
|
|
1753
|
-
}
|
|
1754
|
-
if (this._readOnlyLocks.has(lockId)) {
|
|
1755
|
-
return;
|
|
1756
|
-
}
|
|
1757
|
-
this._readOnlyLocks.add(lockId);
|
|
1758
|
-
if (this._readOnlyLocks.size === 1) {
|
|
1759
|
-
// Manually fire the `change:isReadOnly` event as only getter is provided.
|
|
1760
|
-
this.fire('change:isReadOnly', 'isReadOnly', true, false);
|
|
1761
|
-
}
|
|
1762
|
-
}
|
|
1763
|
-
/**
|
|
1764
|
-
* Removes the read-only lock from the editor with given lock ID.
|
|
1765
|
-
*
|
|
1766
|
-
* When no lock is present on the editor anymore, then the {@link #isReadOnly `isReadOnly` property} will be set to `false`.
|
|
1767
|
-
*
|
|
1768
|
-
* @param lockId The lock ID for setting the editor to the read-only state.
|
|
1769
|
-
*/
|
|
1770
|
-
disableReadOnlyMode(lockId) {
|
|
1771
|
-
if (typeof lockId !== 'string' && typeof lockId !== 'symbol') {
|
|
1772
|
-
throw new CKEditorError('editor-read-only-lock-id-invalid', null, { lockId });
|
|
1773
|
-
}
|
|
1774
|
-
if (!this._readOnlyLocks.has(lockId)) {
|
|
1775
|
-
return;
|
|
1776
|
-
}
|
|
1777
|
-
this._readOnlyLocks.delete(lockId);
|
|
1778
|
-
if (this._readOnlyLocks.size === 0) {
|
|
1779
|
-
// Manually fire the `change:isReadOnly` event as only getter is provided.
|
|
1780
|
-
this.fire('change:isReadOnly', 'isReadOnly', false, true);
|
|
1781
|
-
}
|
|
1782
|
-
}
|
|
1783
|
-
/**
|
|
1784
|
-
* Sets the data in the editor.
|
|
1785
|
-
*
|
|
1786
|
-
* ```ts
|
|
1787
|
-
* editor.setData( '<p>This is editor!</p>' );
|
|
1788
|
-
* ```
|
|
1789
|
-
*
|
|
1790
|
-
* If your editor implementation uses multiple roots, you should pass an object with keys corresponding
|
|
1791
|
-
* to the editor root names and values equal to the data that should be set in each root:
|
|
1792
|
-
*
|
|
1793
|
-
* ```ts
|
|
1794
|
-
* editor.setData( {
|
|
1795
|
-
* header: '<p>Content for header part.</p>',
|
|
1796
|
-
* content: '<p>Content for main part.</p>',
|
|
1797
|
-
* footer: '<p>Content for footer part.</p>'
|
|
1798
|
-
* } );
|
|
1799
|
-
* ```
|
|
1800
|
-
*
|
|
1801
|
-
* By default the editor accepts HTML. This can be controlled by injecting a different data processor.
|
|
1802
|
-
* See the {@glink features/markdown Markdown output} guide for more details.
|
|
1803
|
-
*
|
|
1804
|
-
* @param data Input data.
|
|
1805
|
-
*/
|
|
1806
|
-
setData(data) {
|
|
1807
|
-
this.data.set(data);
|
|
1808
|
-
}
|
|
1809
|
-
/**
|
|
1810
|
-
* Gets the data from the editor.
|
|
1811
|
-
*
|
|
1812
|
-
* ```ts
|
|
1813
|
-
* editor.getData(); // -> '<p>This is editor!</p>'
|
|
1814
|
-
* ```
|
|
1815
|
-
*
|
|
1816
|
-
* If your editor implementation uses multiple roots, you should pass root name as one of the options:
|
|
1817
|
-
*
|
|
1818
|
-
* ```ts
|
|
1819
|
-
* editor.getData( { rootName: 'header' } ); // -> '<p>Content for header part.</p>'
|
|
1820
|
-
* ```
|
|
1821
|
-
*
|
|
1822
|
-
* By default, the editor outputs HTML. This can be controlled by injecting a different data processor.
|
|
1823
|
-
* See the {@glink features/markdown Markdown output} guide for more details.
|
|
1824
|
-
*
|
|
1825
|
-
* A warning is logged when you try to retrieve data for a detached root, as most probably this is a mistake. A detached root should
|
|
1826
|
-
* be treated like it is removed, and you should not save its data. Note, that the detached root data is always an empty string.
|
|
1827
|
-
*
|
|
1828
|
-
* @param options Additional configuration for the retrieved data.
|
|
1829
|
-
* Editor features may introduce more configuration options that can be set through this parameter.
|
|
1830
|
-
* @param options.rootName Root name. Defaults to `'main'`.
|
|
1831
|
-
* @param options.trim Whether returned data should be trimmed. This option is set to `'empty'` by default,
|
|
1832
|
-
* which means that whenever editor content is considered empty, an empty string is returned. To turn off trimming
|
|
1833
|
-
* use `'none'`. In such cases exact content will be returned (for example `'<p> </p>'` for an empty editor).
|
|
1834
|
-
* @returns Output data.
|
|
1835
|
-
*/
|
|
1836
|
-
getData(options) {
|
|
1837
|
-
return this.data.get(options);
|
|
1838
|
-
}
|
|
1839
|
-
/**
|
|
1840
|
-
* Loads and initializes plugins specified in the configuration.
|
|
1841
|
-
*
|
|
1842
|
-
* @returns A promise which resolves once the initialization is completed, providing an array of loaded plugins.
|
|
1843
|
-
*/
|
|
1844
|
-
initPlugins() {
|
|
1845
|
-
const config = this.config;
|
|
1846
|
-
const plugins = config.get('plugins');
|
|
1847
|
-
const removePlugins = config.get('removePlugins') || [];
|
|
1848
|
-
const extraPlugins = config.get('extraPlugins') || [];
|
|
1849
|
-
const substitutePlugins = config.get('substitutePlugins') || [];
|
|
1850
|
-
return this.plugins.init(plugins.concat(extraPlugins), removePlugins, substitutePlugins);
|
|
1851
|
-
}
|
|
1852
|
-
/**
|
|
1853
|
-
* Destroys the editor instance, releasing all resources used by it.
|
|
1854
|
-
*
|
|
1855
|
-
* **Note** The editor cannot be destroyed during the initialization phase so if it is called
|
|
1856
|
-
* while the editor {@link #state is being initialized}, it will wait for the editor initialization before destroying it.
|
|
1857
|
-
*
|
|
1858
|
-
* @fires destroy
|
|
1859
|
-
* @returns A promise that resolves once the editor instance is fully destroyed.
|
|
1860
|
-
*/
|
|
1861
|
-
destroy() {
|
|
1862
|
-
let readyPromise = Promise.resolve();
|
|
1863
|
-
if (this.state == 'initializing') {
|
|
1864
|
-
readyPromise = new Promise(resolve => this.once('ready', resolve));
|
|
1865
|
-
}
|
|
1866
|
-
return readyPromise
|
|
1867
|
-
.then(() => {
|
|
1868
|
-
this.fire('destroy');
|
|
1869
|
-
this.stopListening();
|
|
1870
|
-
this.commands.destroy();
|
|
1871
|
-
})
|
|
1872
|
-
.then(() => this.plugins.destroy())
|
|
1873
|
-
.then(() => {
|
|
1874
|
-
this.model.destroy();
|
|
1875
|
-
this.data.destroy();
|
|
1876
|
-
this.editing.destroy();
|
|
1877
|
-
this.keystrokes.destroy();
|
|
1878
|
-
})
|
|
1879
|
-
// Remove the editor from the context.
|
|
1880
|
-
// When the context was created by this editor, the context will be destroyed.
|
|
1881
|
-
.then(() => this._context._removeEditor(this));
|
|
1882
|
-
}
|
|
1883
|
-
/**
|
|
1884
|
-
* Executes the specified command with given parameters.
|
|
1885
|
-
*
|
|
1886
|
-
* Shorthand for:
|
|
1887
|
-
*
|
|
1888
|
-
* ```ts
|
|
1889
|
-
* editor.commands.get( commandName ).execute( ... );
|
|
1890
|
-
* ```
|
|
1891
|
-
*
|
|
1892
|
-
* @param commandName The name of the command to execute.
|
|
1893
|
-
* @param commandParams Command parameters.
|
|
1894
|
-
* @returns The value returned by the {@link module:core/commandcollection~CommandCollection#execute `commands.execute()`}.
|
|
1895
|
-
*/
|
|
1896
|
-
execute(commandName, ...commandParams) {
|
|
1897
|
-
try {
|
|
1898
|
-
return this.commands.execute(commandName, ...commandParams);
|
|
1899
|
-
}
|
|
1900
|
-
catch (err) {
|
|
1901
|
-
// @if CK_DEBUG // throw err;
|
|
1902
|
-
/* istanbul ignore next -- @preserve */
|
|
1903
|
-
CKEditorError.rethrowUnexpectedError(err, this);
|
|
1904
|
-
}
|
|
1905
|
-
}
|
|
1906
|
-
/**
|
|
1907
|
-
* Focuses the editor.
|
|
1908
|
-
*
|
|
1909
|
-
* **Note** To explicitly focus the editing area of the editor, use the
|
|
1910
|
-
* {@link module:engine/view/view~View#focus `editor.editing.view.focus()`} method of the editing view.
|
|
1911
|
-
*
|
|
1912
|
-
* Check out the {@glink framework/deep-dive/ui/focus-tracking#focus-in-the-editor-ui Focus in the editor UI} section
|
|
1913
|
-
* of the {@glink framework/deep-dive/ui/focus-tracking Deep dive into focus tracking} guide to learn more.
|
|
1914
|
-
*/
|
|
1915
|
-
focus() {
|
|
1916
|
-
this.editing.view.focus();
|
|
1917
|
-
}
|
|
1918
|
-
/* istanbul ignore next -- @preserve */
|
|
1919
|
-
/**
|
|
1920
|
-
* Creates and initializes a new editor instance.
|
|
1921
|
-
*
|
|
1922
|
-
* This is an abstract method. Every editor type needs to implement its own initialization logic.
|
|
1923
|
-
*
|
|
1924
|
-
* See the `create()` methods of the existing editor types to learn how to use them:
|
|
1925
|
-
*
|
|
1926
|
-
* * {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`}
|
|
1927
|
-
* * {@link module:editor-balloon/ballooneditor~BalloonEditor.create `BalloonEditor.create()`}
|
|
1928
|
-
* * {@link module:editor-decoupled/decouplededitor~DecoupledEditor.create `DecoupledEditor.create()`}
|
|
1929
|
-
* * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`}
|
|
1930
|
-
*/
|
|
1931
|
-
static create(...args) {
|
|
1932
|
-
throw new Error('This is an abstract method.');
|
|
1933
|
-
}
|
|
1934
|
-
}
|
|
1935
|
-
/**
|
|
1936
|
-
* This error is thrown when trying to pass a `<textarea>` element to a `create()` function of an editor class.
|
|
1937
|
-
*
|
|
1938
|
-
* The only editor type which can be initialized on `<textarea>` elements is
|
|
1939
|
-
* the {@glink installation/getting-started/predefined-builds#classic-editor classic editor}.
|
|
1940
|
-
* This editor hides the passed element and inserts its own UI next to it. Other types of editors reuse the passed element as their root
|
|
1941
|
-
* editable element and therefore `<textarea>` is not appropriate for them. Use a `<div>` or another text container instead:
|
|
1942
|
-
*
|
|
1943
|
-
* ```html
|
|
1944
|
-
* <div id="editor">
|
|
1945
|
-
* <p>Initial content.</p>
|
|
1946
|
-
* </div>
|
|
1947
|
-
* ```
|
|
1948
|
-
*
|
|
1949
|
-
* @error editor-wrong-element
|
|
1950
|
-
*/
|
|
1951
|
-
|
|
1952
|
-
/**
|
|
1953
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1954
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1955
|
-
*/
|
|
1956
|
-
/**
|
|
1957
|
-
* @module core/editor/utils/attachtoform
|
|
1958
|
-
*/
|
|
1959
|
-
/**
|
|
1960
|
-
* Checks if the editor is initialized on a `<textarea>` element that belongs to a form. If yes, it updates the editor's element
|
|
1961
|
-
* content before submitting the form.
|
|
1962
|
-
*
|
|
1963
|
-
* This helper requires the {@link module:core/editor/utils/elementapimixin~ElementApi ElementApi interface}.
|
|
1964
|
-
*
|
|
1965
|
-
* @param editor Editor instance.
|
|
1966
|
-
*/
|
|
1967
|
-
function attachToForm(editor) {
|
|
1968
|
-
if (!isFunction(editor.updateSourceElement)) {
|
|
1969
|
-
/**
|
|
1970
|
-
* The editor passed to `attachToForm()` must implement the
|
|
1971
|
-
* {@link module:core/editor/utils/elementapimixin~ElementApi} interface.
|
|
1972
|
-
*
|
|
1973
|
-
* @error attachtoform-missing-elementapi-interface
|
|
1974
|
-
*/
|
|
1975
|
-
throw new CKEditorError('attachtoform-missing-elementapi-interface', editor);
|
|
1976
|
-
}
|
|
1977
|
-
const sourceElement = editor.sourceElement;
|
|
1978
|
-
// Only when replacing a textarea which is inside of a form element.
|
|
1979
|
-
if (isTextArea(sourceElement) && sourceElement.form) {
|
|
1980
|
-
let originalSubmit;
|
|
1981
|
-
const form = sourceElement.form;
|
|
1982
|
-
const onSubmit = () => editor.updateSourceElement();
|
|
1983
|
-
// Replace the original form#submit() to call a custom submit function first.
|
|
1984
|
-
// Check if #submit is a function because the form might have an input named "submit".
|
|
1985
|
-
if (isFunction(form.submit)) {
|
|
1986
|
-
originalSubmit = form.submit;
|
|
1987
|
-
form.submit = () => {
|
|
1988
|
-
onSubmit();
|
|
1989
|
-
originalSubmit.apply(form);
|
|
1990
|
-
};
|
|
1991
|
-
}
|
|
1992
|
-
// Update the replaced textarea with data before each form#submit event.
|
|
1993
|
-
form.addEventListener('submit', onSubmit);
|
|
1994
|
-
// Remove the submit listener and revert the original submit method on
|
|
1995
|
-
// editor#destroy.
|
|
1996
|
-
editor.on('destroy', () => {
|
|
1997
|
-
form.removeEventListener('submit', onSubmit);
|
|
1998
|
-
if (originalSubmit) {
|
|
1999
|
-
form.submit = originalSubmit;
|
|
2000
|
-
}
|
|
2001
|
-
});
|
|
2002
|
-
}
|
|
2003
|
-
}
|
|
2004
|
-
function isTextArea(sourceElement) {
|
|
2005
|
-
return !!sourceElement && sourceElement.tagName.toLowerCase() === 'textarea';
|
|
2006
|
-
}
|
|
2007
|
-
|
|
2008
|
-
/**
|
|
2009
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
2010
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
2011
|
-
*/
|
|
2012
|
-
/**
|
|
2013
|
-
* Implementation of the {@link module:core/editor/utils/dataapimixin~DataApi}.
|
|
2014
|
-
*
|
|
2015
|
-
* @deprecated This functionality is already implemented by the `Editor` class.
|
|
2016
|
-
*/
|
|
2017
|
-
function DataApiMixin(base) {
|
|
2018
|
-
return base;
|
|
2019
|
-
}
|
|
2020
|
-
|
|
2021
|
-
/**
|
|
2022
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
2023
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
2024
|
-
*/
|
|
2025
|
-
/**
|
|
2026
|
-
* @module core/editor/utils/elementapimixin
|
|
2027
|
-
*/
|
|
2028
|
-
/**
|
|
2029
|
-
* Implementation of the {@link module:core/editor/utils/elementapimixin~ElementApi}.
|
|
2030
|
-
*/
|
|
2031
|
-
function ElementApiMixin(base) {
|
|
2032
|
-
class Mixin extends base {
|
|
2033
|
-
updateSourceElement(data) {
|
|
2034
|
-
if (!this.sourceElement) {
|
|
2035
|
-
/**
|
|
2036
|
-
* Cannot update the source element of a detached editor.
|
|
2037
|
-
*
|
|
2038
|
-
* The {@link module:core/editor/utils/elementapimixin~ElementApi#updateSourceElement `updateSourceElement()`}
|
|
2039
|
-
* method cannot be called if you did not pass an element to `Editor.create()`.
|
|
2040
|
-
*
|
|
2041
|
-
* @error editor-missing-sourceelement
|
|
2042
|
-
*/
|
|
2043
|
-
throw new CKEditorError('editor-missing-sourceelement', this);
|
|
2044
|
-
}
|
|
2045
|
-
const shouldUpdateSourceElement = this.config.get('updateSourceElementOnDestroy');
|
|
2046
|
-
const isSourceElementTextArea = this.sourceElement instanceof HTMLTextAreaElement;
|
|
2047
|
-
// The data returned by the editor might be unsafe, so we want to prevent rendering
|
|
2048
|
-
// unsafe content inside the source element different than <textarea>, which is considered
|
|
2049
|
-
// secure. This behavior could be changed by setting the `updateSourceElementOnDestroy`
|
|
2050
|
-
// configuration option to `true`.
|
|
2051
|
-
if (!shouldUpdateSourceElement && !isSourceElementTextArea) {
|
|
2052
|
-
setDataInElement(this.sourceElement, '');
|
|
2053
|
-
return;
|
|
2054
|
-
}
|
|
2055
|
-
const dataToSet = typeof data === 'string' ? data : this.data.get();
|
|
2056
|
-
setDataInElement(this.sourceElement, dataToSet);
|
|
2057
|
-
}
|
|
2058
|
-
}
|
|
2059
|
-
return Mixin;
|
|
2060
|
-
}
|
|
2061
|
-
// Backward compatibility with `mix`.
|
|
2062
|
-
ElementApiMixin.updateSourceElement = ElementApiMixin(Object).prototype.updateSourceElement;
|
|
2063
|
-
|
|
2064
|
-
/**
|
|
2065
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
2066
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
2067
|
-
*/
|
|
2068
|
-
/**
|
|
2069
|
-
* @module core/editor/utils/securesourceelement
|
|
2070
|
-
*/
|
|
2071
|
-
/**
|
|
2072
|
-
* Marks the source element on which the editor was initialized. This prevents other editor instances from using this element.
|
|
2073
|
-
*
|
|
2074
|
-
* Running multiple editor instances on the same source element causes various issues and it is
|
|
2075
|
-
* crucial this helper is called as soon as the source element is known to prevent collisions.
|
|
2076
|
-
*
|
|
2077
|
-
* @param editor Editor instance.
|
|
2078
|
-
* @param sourceElement Element to bind with the editor instance.
|
|
2079
|
-
*/
|
|
2080
|
-
function secureSourceElement(editor, sourceElement) {
|
|
2081
|
-
if (sourceElement.ckeditorInstance) {
|
|
2082
|
-
/**
|
|
2083
|
-
* A DOM element used to create the editor (e.g.
|
|
2084
|
-
* {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`})
|
|
2085
|
-
* has already been used to create another editor instance. Make sure each editor is
|
|
2086
|
-
* created with an unique DOM element.
|
|
2087
|
-
*
|
|
2088
|
-
* @error editor-source-element-already-used
|
|
2089
|
-
* @param element DOM element that caused the collision.
|
|
2090
|
-
*/
|
|
2091
|
-
throw new CKEditorError('editor-source-element-already-used', editor);
|
|
2092
|
-
}
|
|
2093
|
-
sourceElement.ckeditorInstance = editor;
|
|
2094
|
-
editor.once('destroy', () => {
|
|
2095
|
-
delete sourceElement.ckeditorInstance;
|
|
2096
|
-
});
|
|
2097
|
-
}
|
|
2098
|
-
|
|
2099
|
-
/**
|
|
2100
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
2101
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
2102
|
-
*/
|
|
2103
|
-
/**
|
|
2104
|
-
* @module core/pendingactions
|
|
2105
|
-
*/
|
|
2106
|
-
/**
|
|
2107
|
-
* The list of pending editor actions.
|
|
2108
|
-
*
|
|
2109
|
-
* This plugin should be used to synchronise plugins that execute long-lasting actions
|
|
2110
|
-
* (e.g. file upload) with the editor integration. It gives the developer who integrates the editor
|
|
2111
|
-
* an easy way to check if there are any actions pending whenever such information is needed.
|
|
2112
|
-
* All plugins that register a pending action also provide a message about the action that is ongoing
|
|
2113
|
-
* which can be displayed to the user. This lets them decide if they want to interrupt the action or wait.
|
|
2114
|
-
*
|
|
2115
|
-
* Adding and updating a pending action:
|
|
2116
|
-
*
|
|
2117
|
-
* ```ts
|
|
2118
|
-
* const pendingActions = editor.plugins.get( 'PendingActions' );
|
|
2119
|
-
* const action = pendingActions.add( 'Upload in progress: 0%.' );
|
|
2120
|
-
*
|
|
2121
|
-
* // You can update the message:
|
|
2122
|
-
* action.message = 'Upload in progress: 10%.';
|
|
2123
|
-
* ```
|
|
2124
|
-
*
|
|
2125
|
-
* Removing a pending action:
|
|
2126
|
-
*
|
|
2127
|
-
* ```ts
|
|
2128
|
-
* const pendingActions = editor.plugins.get( 'PendingActions' );
|
|
2129
|
-
* const action = pendingActions.add( 'Unsaved changes.' );
|
|
2130
|
-
*
|
|
2131
|
-
* pendingActions.remove( action );
|
|
2132
|
-
* ```
|
|
2133
|
-
*
|
|
2134
|
-
* Getting pending actions:
|
|
2135
|
-
*
|
|
2136
|
-
* ```ts
|
|
2137
|
-
* const pendingActions = editor.plugins.get( 'PendingActions' );
|
|
2138
|
-
*
|
|
2139
|
-
* const action1 = pendingActions.add( 'Action 1' );
|
|
2140
|
-
* const action2 = pendingActions.add( 'Action 2' );
|
|
2141
|
-
*
|
|
2142
|
-
* pendingActions.first; // Returns action1
|
|
2143
|
-
* Array.from( pendingActions ); // Returns [ action1, action2 ]
|
|
2144
|
-
* ```
|
|
2145
|
-
*
|
|
2146
|
-
* This plugin is used by features like {@link module:upload/filerepository~FileRepository} to register their ongoing actions
|
|
2147
|
-
* and by features like {@link module:autosave/autosave~Autosave} to detect whether there are any ongoing actions.
|
|
2148
|
-
* Read more about saving the data in the {@glink installation/getting-started/getting-and-setting-data Saving and getting data} guide.
|
|
2149
|
-
*/
|
|
2150
|
-
class PendingActions extends ContextPlugin {
|
|
2151
|
-
/**
|
|
2152
|
-
* @inheritDoc
|
|
2153
|
-
*/
|
|
2154
|
-
static get pluginName() {
|
|
2155
|
-
return 'PendingActions';
|
|
2156
|
-
}
|
|
2157
|
-
/**
|
|
2158
|
-
* @inheritDoc
|
|
2159
|
-
*/
|
|
2160
|
-
init() {
|
|
2161
|
-
this.set('hasAny', false);
|
|
2162
|
-
this._actions = new Collection({ idProperty: '_id' });
|
|
2163
|
-
this._actions.delegate('add', 'remove').to(this);
|
|
2164
|
-
}
|
|
2165
|
-
/**
|
|
2166
|
-
* Adds an action to the list of pending actions.
|
|
2167
|
-
*
|
|
2168
|
-
* This method returns an action object with an observable message property.
|
|
2169
|
-
* The action object can be later used in the {@link #remove} method. It also allows you to change the message.
|
|
2170
|
-
*
|
|
2171
|
-
* @param message The action message.
|
|
2172
|
-
* @returns An observable object that represents a pending action.
|
|
2173
|
-
*/
|
|
2174
|
-
add(message) {
|
|
2175
|
-
if (typeof message !== 'string') {
|
|
2176
|
-
/**
|
|
2177
|
-
* The message must be a string.
|
|
2178
|
-
*
|
|
2179
|
-
* @error pendingactions-add-invalid-message
|
|
2180
|
-
*/
|
|
2181
|
-
throw new CKEditorError('pendingactions-add-invalid-message', this);
|
|
2182
|
-
}
|
|
2183
|
-
const action = new (ObservableMixin())();
|
|
2184
|
-
action.set('message', message);
|
|
2185
|
-
this._actions.add(action);
|
|
2186
|
-
this.hasAny = true;
|
|
2187
|
-
return action;
|
|
2188
|
-
}
|
|
2189
|
-
/**
|
|
2190
|
-
* Removes an action from the list of pending actions.
|
|
2191
|
-
*
|
|
2192
|
-
* @param action An action object.
|
|
2193
|
-
*/
|
|
2194
|
-
remove(action) {
|
|
2195
|
-
this._actions.remove(action);
|
|
2196
|
-
this.hasAny = !!this._actions.length;
|
|
2197
|
-
}
|
|
2198
|
-
/**
|
|
2199
|
-
* Returns the first action from the list or null if the list is empty
|
|
2200
|
-
*
|
|
2201
|
-
* @returns The pending action object.
|
|
2202
|
-
*/
|
|
2203
|
-
get first() {
|
|
2204
|
-
return this._actions.get(0);
|
|
2205
|
-
}
|
|
2206
|
-
/**
|
|
2207
|
-
* Iterable interface.
|
|
2208
|
-
*/
|
|
2209
|
-
[Symbol.iterator]() {
|
|
2210
|
-
return this._actions[Symbol.iterator]();
|
|
2211
|
-
}
|
|
2212
|
-
}
|
|
2213
|
-
|
|
2214
|
-
var cancel = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m11.591 10.177 4.243 4.242a1 1 0 0 1-1.415 1.415l-4.242-4.243-4.243 4.243a1 1 0 0 1-1.414-1.415l4.243-4.242L4.52 5.934A1 1 0 0 1 5.934 4.52l4.243 4.243 4.242-4.243a1 1 0 1 1 1.415 1.414l-4.243 4.243z\"/></svg>";
|
|
2215
|
-
|
|
2216
|
-
var caption = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M2 16h9a1 1 0 0 1 0 2H2a1 1 0 0 1 0-2z\"/><path d=\"M17 1a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14zm0 1.5H3a.5.5 0 0 0-.492.41L2.5 3v9a.5.5 0 0 0 .41.492L3 12.5h14a.5.5 0 0 0 .492-.41L17.5 12V3a.5.5 0 0 0-.41-.492L17 2.5z\" fill-opacity=\".6\"/></svg>";
|
|
2217
|
-
|
|
2218
|
-
var check = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M6.972 16.615a.997.997 0 0 1-.744-.292l-4.596-4.596a1 1 0 1 1 1.414-1.414l3.926 3.926 9.937-9.937a1 1 0 0 1 1.414 1.415L7.717 16.323a.997.997 0 0 1-.745.292z\"/></svg>";
|
|
2219
|
-
|
|
2220
|
-
var cog = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m11.333 2 .19 2.263a5.899 5.899 0 0 1 1.458.604L14.714 3.4 16.6 5.286l-1.467 1.733c.263.452.468.942.605 1.46L18 8.666v2.666l-2.263.19a5.899 5.899 0 0 1-.604 1.458l1.467 1.733-1.886 1.886-1.733-1.467a5.899 5.899 0 0 1-1.46.605L11.334 18H8.667l-.19-2.263a5.899 5.899 0 0 1-1.458-.604L5.286 16.6 3.4 14.714l1.467-1.733a5.899 5.899 0 0 1-.604-1.458L2 11.333V8.667l2.262-.189a5.899 5.899 0 0 1 .605-1.459L3.4 5.286 5.286 3.4l1.733 1.467a5.899 5.899 0 0 1 1.46-.605L8.666 2h2.666zM10 6.267a3.733 3.733 0 1 0 0 7.466 3.733 3.733 0 0 0 0-7.466z\"/></svg>";
|
|
2221
|
-
|
|
2222
|
-
var colorPalette = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M10.209 18.717A8.5 8.5 0 1 1 18.686 9.6h-.008l.002.12a3 3 0 0 1-2.866 2.997h-.268l-.046-.002v.002h-4.791a2 2 0 1 0 0 4 1 1 0 1 1-.128 1.992 8.665 8.665 0 0 1-.372.008Zm-3.918-7.01a1.25 1.25 0 1 0-2.415-.648 1.25 1.25 0 0 0 2.415.647ZM5.723 8.18a1.25 1.25 0 1 0 .647-2.414 1.25 1.25 0 0 0-.647 2.414ZM9.76 6.155a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415Zm4.028 1.759a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415Z\"/></svg>";
|
|
2223
|
-
|
|
2224
|
-
var eraser = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m8.636 9.531-2.758 3.94a.5.5 0 0 0 .122.696l3.224 2.284h1.314l2.636-3.736L8.636 9.53zm.288 8.451L5.14 15.396a2 2 0 0 1-.491-2.786l6.673-9.53a2 2 0 0 1 2.785-.49l3.742 2.62a2 2 0 0 1 .491 2.785l-7.269 10.053-2.147-.066z\"/><path d=\"M4 18h5.523v-1H4zm-2 0h1v-1H2z\"/></svg>";
|
|
2225
|
-
|
|
2226
|
-
var history = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M11 1a9 9 0 1 1-8.027 13.075l1.128-1.129A7.502 7.502 0 0 0 18.5 10a7.5 7.5 0 1 0-14.962.759l-.745-.746-.76.76A9 9 0 0 1 11 1z\"/><path d=\"M.475 8.17a.75.75 0 0 1 .978.047l.075.082 1.284 1.643 1.681-1.284a.75.75 0 0 1 .978.057l.073.083a.75.75 0 0 1-.057.978l-.083.073-2.27 1.737a.75.75 0 0 1-.973-.052l-.074-.082-1.741-2.23a.75.75 0 0 1 .13-1.052z\"/><path d=\"M11.5 5v4.999l3.196 3.196-1.06 1.06L10.1 10.72l-.1-.113V5z\"/></svg>";
|
|
2227
|
-
|
|
2228
|
-
var lowVision = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M5.085 6.22 2.943 4.078a.75.75 0 1 1 1.06-1.06l2.592 2.59A11.094 11.094 0 0 1 10 5.068c4.738 0 8.578 3.101 8.578 5.083 0 1.197-1.401 2.803-3.555 3.887l1.714 1.713a.75.75 0 0 1-.09 1.138.488.488 0 0 1-.15.084.75.75 0 0 1-.821-.16L6.17 7.304c-.258.11-.51.233-.757.365l6.239 6.24-.006.005.78.78c-.388.094-.78.166-1.174.215l-1.11-1.11h.011L4.55 8.197a7.2 7.2 0 0 0-.665.514l-.112.098 4.897 4.897-.005.006 1.276 1.276a10.164 10.164 0 0 1-1.477-.117l-.479-.479-.009.009-4.863-4.863-.022.031a2.563 2.563 0 0 0-.124.2c-.043.077-.08.158-.108.241a.534.534 0 0 0-.028.133.29.29 0 0 0 .008.072.927.927 0 0 0 .082.226c.067.133.145.26.234.379l3.242 3.365.025.01.59.623c-3.265-.918-5.59-3.155-5.59-4.668 0-1.194 1.448-2.838 3.663-3.93zm7.07.531a4.632 4.632 0 0 1 1.108 5.992l.345.344.046-.018a9.313 9.313 0 0 0 2-1.112c.256-.187.5-.392.727-.613.137-.134.27-.277.392-.431.072-.091.141-.185.203-.286.057-.093.107-.19.148-.292a.72.72 0 0 0 .036-.12.29.29 0 0 0 .008-.072.492.492 0 0 0-.028-.133.999.999 0 0 0-.036-.096 2.165 2.165 0 0 0-.071-.145 2.917 2.917 0 0 0-.125-.2 3.592 3.592 0 0 0-.263-.335 5.444 5.444 0 0 0-.53-.523 7.955 7.955 0 0 0-1.054-.768 9.766 9.766 0 0 0-1.879-.891c-.337-.118-.68-.219-1.027-.301zm-2.85.21-.069.002a.508.508 0 0 0-.254.097.496.496 0 0 0-.104.679.498.498 0 0 0 .326.199l.045.005c.091.003.181.003.272.012a2.45 2.45 0 0 1 2.017 1.513c.024.061.043.125.069.185a.494.494 0 0 0 .45.287h.008a.496.496 0 0 0 .35-.158.482.482 0 0 0 .13-.335.638.638 0 0 0-.048-.219 3.379 3.379 0 0 0-.36-.723 3.438 3.438 0 0 0-2.791-1.543l-.028-.001h-.013z\"/></svg>";
|
|
2229
|
-
|
|
2230
|
-
var textAlternative = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M3.035 1C2.446 1 2 1.54 2 2.098V10.5h1.5v-8h13v8H18V2.098C18 1.539 17.48 1 16.9 1H3.035Zm10.453 2.61a1.885 1.885 0 0 0-1.442.736 1.89 1.89 0 0 0 1.011 2.976 1.903 1.903 0 0 0 2.253-1.114 1.887 1.887 0 0 0-1.822-2.598ZM7.463 8.163a.611.611 0 0 0-.432.154L5.071 10.5h5.119L7.88 8.348a.628.628 0 0 0-.417-.185Zm6.236 1.059a.62.62 0 0 0-.42.164L12.07 10.5h2.969l-.92-1.113a.618.618 0 0 0-.42-.165ZM.91 11.5a.91.91 0 0 0-.91.912v6.877c0 .505.405.91.91.91h18.178a.91.91 0 0 0 .912-.91v-6.877a.908.908 0 0 0-.912-.912H.91ZM3.668 13h1.947l2.135 5.7H5.898l-.28-.946H3.601l-.278.945H1.516L3.668 13Zm4.947 0h1.801v4.3h2.7v1.4h-4.5V13h-.001Zm4.5 0h5.4v1.4h-1.798v4.3h-1.701v-4.3h-1.9V13h-.001Zm-8.517 1.457-.614 2.059h1.262l-.648-2.059Z\"/></svg>";
|
|
2231
|
-
|
|
2232
|
-
var loupe = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M12.68 13.74h-.001l4.209 4.208a1 1 0 1 0 1.414-1.414l-4.267-4.268a6 6 0 1 0-1.355 1.474ZM13 9a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z\"/></svg>";
|
|
2233
|
-
|
|
2234
|
-
var previousArrow = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M11.463 5.187a.888.888 0 1 1 1.254 1.255L9.16 10l3.557 3.557a.888.888 0 1 1-1.254 1.255L7.26 10.61a.888.888 0 0 1 .16-1.382l4.043-4.042z\"/></svg>";
|
|
2235
|
-
|
|
2236
|
-
var nextArrow = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M8.537 14.813a.888.888 0 1 1-1.254-1.255L10.84 10 7.283 6.442a.888.888 0 1 1 1.254-1.255L12.74 9.39a.888.888 0 0 1-.16 1.382l-4.043 4.042z\"/></svg>";
|
|
2237
|
-
|
|
2238
|
-
var image = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M6.66 9.118a.693.693 0 0 1 .956.032l3.65 3.411 2.422-2.238a.695.695 0 0 1 .945 0L17.5 13.6V2.5h-15v11.1l4.16-4.482ZM17.8 1c.652 0 1.2.47 1.2 1.1v14.362c0 .64-.532 1.038-1.184 1.038H2.184C1.532 17.5 1 17.103 1 16.462V2.1C1 1.47 1.537 1 2.2 1h15.6Zm-5.655 6a2.128 2.128 0 0 1 .157-2.364A2.133 2.133 0 1 1 12.145 7Z\"/></svg>";
|
|
2239
|
-
|
|
2240
|
-
var imageUpload = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M1.201 1C.538 1 0 1.47 0 2.1v14.363c0 .64.534 1.037 1.186 1.037h9.494a2.97 2.97 0 0 1-.414-.287 2.998 2.998 0 0 1-1.055-2.03 3.003 3.003 0 0 1 .693-2.185l.383-.455-.02.018-3.65-3.41a.695.695 0 0 0-.957-.034L1.5 13.6V2.5h15v5.535a2.97 2.97 0 0 1 1.412.932l.088.105V2.1c0-.63-.547-1.1-1.2-1.1H1.202Zm11.713 2.803a2.146 2.146 0 0 0-2.049 1.992 2.14 2.14 0 0 0 1.28 2.096 2.13 2.13 0 0 0 2.644-3.11 2.134 2.134 0 0 0-1.875-.978Z\"/><path d=\"M15.522 19.1a.79.79 0 0 0 .79-.79v-5.373l2.059 2.455a.79.79 0 1 0 1.211-1.015l-3.352-3.995a.79.79 0 0 0-.995-.179.784.784 0 0 0-.299.221l-3.35 3.99a.79.79 0 1 0 1.21 1.017l1.936-2.306v5.185c0 .436.353.79.79.79Z\"/><path d=\"M15.522 19.1a.79.79 0 0 0 .79-.79v-5.373l2.059 2.455a.79.79 0 1 0 1.211-1.015l-3.352-3.995a.79.79 0 0 0-.995-.179.784.784 0 0 0-.299.221l-3.35 3.99a.79.79 0 1 0 1.21 1.017l1.936-2.306v5.185c0 .436.353.79.79.79Z\"/></svg>";
|
|
2241
|
-
|
|
2242
|
-
var imageAssetManager = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M1.201 1c-.662 0-1.2.47-1.2 1.1v14.248c0 .64.533 1.152 1.185 1.152h6.623v-7.236L6.617 9.15a.694.694 0 0 0-.957-.033L1.602 13.55V2.553l14.798.003V9.7H18V2.1c0-.63-.547-1.1-1.2-1.1H1.202Zm11.723 2.805a2.094 2.094 0 0 0-1.621.832 2.127 2.127 0 0 0 1.136 3.357 2.13 2.13 0 0 0 2.611-1.506 2.133 2.133 0 0 0-.76-2.244 2.13 2.13 0 0 0-1.366-.44Z\"/><path clip-rule=\"evenodd\" d=\"M19.898 12.369v6.187a.844.844 0 0 1-.844.844h-8.719a.844.844 0 0 1-.843-.844v-7.312a.844.844 0 0 1 .843-.844h2.531a.843.843 0 0 1 .597.248l.838.852h4.75c.223 0 .441.114.6.272a.844.844 0 0 1 .247.597Zm-1.52.654-4.377.02-1.1-1.143H11v6h7.4l-.023-4.877Z\"/></svg>";
|
|
2243
|
-
|
|
2244
|
-
var imageUrl = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M1.201 1C.538 1 0 1.47 0 2.1v14.363c0 .64.534 1.037 1.186 1.037h7.029a5.401 5.401 0 0 1 .615-4.338l.762-1.232-2.975-2.78a.696.696 0 0 0-.957-.033L1.5 13.6V2.5h15v6.023c.449.131.887.32 1.307.573l.058.033c.046.028.09.057.135.086V2.1c0-.63-.547-1.1-1.2-1.1H1.202Zm11.713 2.803a2.15 2.15 0 0 0-1.611.834 2.118 2.118 0 0 0-.438 1.158 2.14 2.14 0 0 0 1.277 2.096 2.132 2.132 0 0 0 2.645-3.11 2.13 2.13 0 0 0-1.873-.978Z\"/><path d=\"M16.63 10.294a3.003 3.003 0 0 0-4.142.887l-.117.177a.647.647 0 0 0-.096.492.664.664 0 0 0 .278.418.7.7 0 0 0 .944-.234 1.741 1.741 0 0 1 2.478-.463 1.869 1.869 0 0 1 .476 2.55.637.637 0 0 0-.071.5.646.646 0 0 0 .309.396.627.627 0 0 0 .869-.19l.027-.041a3.226 3.226 0 0 0-.956-4.492Zm-6.061 3.78-.044.066a3.228 3.228 0 0 0 .82 4.403 3.005 3.005 0 0 0 4.275-.798l.13-.197a.626.626 0 0 0 .092-.475.638.638 0 0 0-.268-.402.713.713 0 0 0-.99.26l-.018.029a1.741 1.741 0 0 1-2.477.461 1.87 1.87 0 0 1-.475-2.55l.029-.047a.647.647 0 0 0 .086-.485.66.66 0 0 0-.275-.408l-.04-.027a.609.609 0 0 0-.845.17Z\"/><path d=\"M15.312 13.925c.24-.36.154-.838-.19-1.067-.346-.23-.82-.124-1.059.236l-1.268 1.907c-.239.36-.153.838.192 1.067.345.23.818.123 1.057-.236l1.268-1.907Z\"/></svg>";
|
|
2245
|
-
|
|
2246
|
-
var alignBottom = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m9.239 13.938-2.88-1.663a.75.75 0 0 1 .75-1.3L9 12.067V4.75a.75.75 0 1 1 1.5 0v7.318l1.89-1.093a.75.75 0 0 1 .75 1.3l-2.879 1.663a.752.752 0 0 1-.511.187.752.752 0 0 1-.511-.187zM4.25 17a.75.75 0 1 1 0-1.5h10.5a.75.75 0 0 1 0 1.5H4.25z\"/></svg>";
|
|
2247
|
-
|
|
2248
|
-
var alignMiddle = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M9.75 11.875a.752.752 0 0 1 .508.184l2.883 1.666a.75.75 0 0 1-.659 1.344l-.091-.044-1.892-1.093.001 4.318a.75.75 0 1 1-1.5 0v-4.317l-1.89 1.092a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .51-.187zM15.25 9a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5h10.5zM9.75.375a.75.75 0 0 1 .75.75v4.318l1.89-1.093.092-.045a.75.75 0 0 1 .659 1.344l-2.883 1.667a.752.752 0 0 1-.508.184.752.752 0 0 1-.511-.187L6.359 5.65a.75.75 0 0 1 .75-1.299L9 5.442V1.125a.75.75 0 0 1 .75-.75z\"/></svg>";
|
|
2249
|
-
|
|
2250
|
-
var alignTop = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m10.261 7.062 2.88 1.663a.75.75 0 0 1-.75 1.3L10.5 8.933v7.317a.75.75 0 1 1-1.5 0V8.932l-1.89 1.093a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .511-.187.752.752 0 0 1 .511.187zM15.25 4a.75.75 0 1 1 0 1.5H4.75a.75.75 0 0 1 0-1.5h10.5z\"/></svg>";
|
|
2251
|
-
|
|
2252
|
-
var alignLeft = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z\"/></svg>";
|
|
2253
|
-
|
|
2254
|
-
var alignCenter = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm2.286 4c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75z\"/></svg>";
|
|
2255
|
-
|
|
2256
|
-
var alignRight = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M18 3.75a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 8a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 4a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75zm0-8a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75z\"/></svg>";
|
|
2257
|
-
|
|
2258
|
-
var alignJustify = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z\"/></svg>";
|
|
2259
|
-
|
|
2260
|
-
var objectBlockLeft = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path opacity=\".5\" d=\"M2 3h16v1.5H2zm0 12h16v1.5H2z\"/><path d=\"M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z\"/></svg>";
|
|
2261
|
-
|
|
2262
|
-
var objectCenter = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path opacity=\".5\" d=\"M2 3h16v1.5H2zm0 12h16v1.5H2z\"/><path d=\"M15.003 7v5.5a1 1 0 0 1-1 1H5.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H6.5V12h6.997V7.5z\"/></svg>";
|
|
2263
|
-
|
|
2264
|
-
var objectBlockRight = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path opacity=\".5\" d=\"M2 3h16v1.5H2zm0 12h16v1.5H2z\"/><path d=\"M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H9.5V12h6.997V7.5z\"/></svg>";
|
|
2265
|
-
|
|
2266
|
-
var objectFullWidth = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path opacity=\".5\" d=\"M2 3h16v1.5H2zm0 12h16v1.5H2z\"/><path d=\"M18 7v5.5a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1zm-1.505.5H3.504V12h12.991V7.5z\"/></svg>";
|
|
2267
|
-
|
|
2268
|
-
var objectInline = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path opacity=\".5\" d=\"M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zM2 15h16v1.5H2z\"/><path d=\"M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z\"/></svg>";
|
|
2269
|
-
|
|
2270
|
-
var objectLeft = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path opacity=\".5\" d=\"M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zm0-3H18v1.5h-4.5zm0-3H18v1.5h-4.5zM2 15h16v1.5H2z\"/><path d=\"M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z\"/></svg>";
|
|
2271
|
-
|
|
2272
|
-
var objectRight = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path opacity=\".5\" d=\"M2 3h16v1.5H2zm0 12h16v1.5H2zm0-9h5v1.5H2zm0 3h5v1.5H2zm0 3h5v1.5H2z\"/><path d=\"M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H9.5V12h6.997V7.5z\"/></svg>";
|
|
2273
|
-
|
|
2274
|
-
var objectSizeFull = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\"><path d=\"M2.5 17v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zM1 15.5v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm0-2v1h-1v-1h1zm-19 0v1H0v-1h1zM14.5 2v1h-1V2h1zm2 0v1h-1V2h1zm2 0v1h-1V2h1zm-8 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm8 0v1h-1V2h1zm-10 0v1h-1V2h1z\"/><path d=\"M18.095 2H1.905C.853 2 0 2.895 0 4v12c0 1.105.853 2 1.905 2h16.19C19.147 18 20 17.105 20 16V4c0-1.105-.853-2-1.905-2zm0 1.5c.263 0 .476.224.476.5v12c0 .276-.213.5-.476.5H1.905a.489.489 0 0 1-.476-.5V4c0-.276.213-.5.476-.5h16.19z\"/></svg>";
|
|
2275
|
-
|
|
2276
|
-
var objectSizeLarge = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M2.5 16.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1ZM1 15v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 13v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 11v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 9v1H0V9h1Zm19 0v1h-1V9h1ZM1 7v1H0V7h1Zm19 0v1h-1V7h1ZM1 5v1H0V5h1Zm19 0v1h-1V5h1Zm0-2v1h-1V3h1ZM1 3v1H0V3h1Zm13.5-1.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm-8 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm8 0v1h-1v-1h1Zm-10 0v1h-1v-1h1Z\"/><path d=\"M13 5.5H2a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-8a2 2 0 0 0-2-2ZM13 7a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-8A.5.5 0 0 1 2 7h11Z\"/></svg>";
|
|
2277
|
-
|
|
2278
|
-
var objectSizeSmall = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M2.5 16.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1ZM1 15v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 13v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 11v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 9v1H0V9h1Zm19 0v1h-1V9h1ZM1 7v1H0V7h1Zm19 0v1h-1V7h1ZM1 5v1H0V5h1Zm19 0v1h-1V5h1Zm0-2v1h-1V3h1ZM1 3v1H0V3h1Zm13.5-1.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm-8 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm8 0v1h-1v-1h1Zm-10 0v1h-1v-1h1Z\"/><path d=\"M7 9.5H2a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h5a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2ZM7 11a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-4A.5.5 0 0 1 2 11h5Z\"/></svg>";
|
|
2279
|
-
|
|
2280
|
-
var objectSizeMedium = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M2.5 16.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1ZM1 15v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 13v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 11v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 9v1H0V9h1Zm19 0v1h-1V9h1ZM1 7v1H0V7h1Zm19 0v1h-1V7h1ZM1 5v1H0V5h1Zm19 0v1h-1V5h1Zm0-2v1h-1V3h1ZM1 3v1H0V3h1Zm13.5-1.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm-8 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm8 0v1h-1v-1h1Zm-10 0v1h-1v-1h1Z\"/><path d=\"M10 7.5H2a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2ZM10 9a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-6A.5.5 0 0 1 2 9h8Z\"/></svg>";
|
|
2281
|
-
|
|
2282
|
-
var pencil = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m7.3 17.37-.061.088a1.518 1.518 0 0 1-.934.535l-4.178.663-.806-4.153a1.495 1.495 0 0 1 .187-1.058l.056-.086L8.77 2.639c.958-1.351 2.803-1.076 4.296-.03 1.497 1.047 2.387 2.693 1.433 4.055L7.3 17.37zM9.14 4.728l-5.545 8.346 3.277 2.294 5.544-8.346L9.14 4.728zM6.07 16.512l-3.276-2.295.53 2.73 2.746-.435zM9.994 3.506 13.271 5.8c.316-.452-.16-1.333-1.065-1.966-.905-.634-1.895-.78-2.212-.328zM8 18.5 9.375 17H19v1.5H8z\"/></svg>";
|
|
2283
|
-
|
|
2284
|
-
var pilcrow = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M6.999 2H15a1 1 0 0 1 0 2h-1.004v13a1 1 0 1 1-2 0V4H8.999v13a1 1 0 1 1-2 0v-7A4 4 0 0 1 3 6a4 4 0 0 1 3.999-4z\"/></svg>";
|
|
2285
|
-
|
|
2286
|
-
var quote = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M3 10.423a6.5 6.5 0 0 1 6.056-6.408l.038.67C6.448 5.423 5.354 7.663 5.22 10H9c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574zm8 0a6.5 6.5 0 0 1 6.056-6.408l.038.67c-2.646.739-3.74 2.979-3.873 5.315H17c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574z\"/></svg>";
|
|
2287
|
-
|
|
2288
|
-
var threeVerticalDots = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><circle cx=\"9.5\" cy=\"4.5\" r=\"1.5\"/><circle cx=\"9.5\" cy=\"10.5\" r=\"1.5\"/><circle cx=\"9.5\" cy=\"16.5\" r=\"1.5\"/></svg>";
|
|
2289
|
-
|
|
2290
|
-
var dragIndicator = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M5 3.25a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0\"/><path d=\"M12 3.25a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0\"/><path d=\"M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0\"/><path d=\"M12 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0\"/><path d=\"M5 16.75a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0\"/><path d=\"M12 16.75a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0\"/></svg>";
|
|
2291
|
-
|
|
2292
|
-
var bold = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M10.187 17H5.773c-.637 0-1.092-.138-1.364-.415-.273-.277-.409-.718-.409-1.323V4.738c0-.617.14-1.062.419-1.332.279-.27.73-.406 1.354-.406h4.68c.69 0 1.288.041 1.793.124.506.083.96.242 1.36.478.341.197.644.447.906.75a3.262 3.262 0 0 1 .808 2.162c0 1.401-.722 2.426-2.167 3.075C15.05 10.175 16 11.315 16 13.01a3.756 3.756 0 0 1-2.296 3.504 6.1 6.1 0 0 1-1.517.377c-.571.073-1.238.11-2 .11zm-.217-6.217H7v4.087h3.069c1.977 0 2.965-.69 2.965-2.072 0-.707-.256-1.22-.768-1.537-.512-.319-1.277-.478-2.296-.478zM7 5.13v3.619h2.606c.729 0 1.292-.067 1.69-.2a1.6 1.6 0 0 0 .91-.765c.165-.267.247-.566.247-.897 0-.707-.26-1.176-.778-1.409-.519-.232-1.31-.348-2.375-.348H7z\"/></svg>";
|
|
2293
|
-
|
|
2294
|
-
var paragraph = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M10.5 5.5H7v5h3.5a2.5 2.5 0 1 0 0-5zM5 3h6.5v.025a5 5 0 0 1 0 9.95V13H7v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z\"/></svg>";
|
|
2295
|
-
|
|
2296
|
-
var plus = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M10 2a1 1 0 0 0-1 1v6H3a1 1 0 1 0 0 2h6v6a1 1 0 1 0 2 0v-6h6a1 1 0 1 0 0-2h-6V3a1 1 0 0 0-1-1Z\"/></svg>";
|
|
2297
|
-
|
|
2298
|
-
var text = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M9.816 11.5 7.038 4.785 4.261 11.5h5.555Zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13Z\"/><path d=\"m12.09 17-.534-1.292.848-1.971.545 1.319L12.113 17h-.023Zm1.142-5.187.545 1.319L15.5 9.13l1.858 4.316h-3.45l.398.965h3.467L18.887 17H20l-3.873-9h-1.254l-1.641 3.813Z\"/></svg>";
|
|
2299
|
-
|
|
2300
|
-
var importExport = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M19 4.5 14 0H3v12.673l.868-1.041c.185-.222.4-.402.632-.54V1.5h8v5h5v7.626a2.24 2.24 0 0 1 1.5.822V4.5ZM14 5V2l3.3 3H14Zm-3.692 12.5c.062.105.133.206.213.303L11.52 19H8v-.876a2.243 2.243 0 0 0 1.82-.624h.488Zm7.518-.657a.75.75 0 0 0-1.152-.96L15.5 17.29V12H14v5.29l-1.174-1.408a.75.75 0 0 0-1.152.96l2.346 2.816a.95.95 0 0 0 1.46 0l2.346-2.815Zm-15.056-.38a.75.75 0 0 1-.096-1.056l2.346-2.815a.95.95 0 0 1 1.46 0l2.346 2.815a.75.75 0 1 1-1.152.96L6.5 14.96V20H5v-5.04l-1.174 1.408a.75.75 0 0 1-1.056.096Z\"/></svg>";
|
|
2301
|
-
|
|
2302
|
-
var redo = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m14.958 9.367-2.189 1.837a.75.75 0 0 0 .965 1.149l3.788-3.18a.747.747 0 0 0 .21-.284.75.75 0 0 0-.17-.945L13.77 4.762a.75.75 0 1 0-.964 1.15l2.331 1.955H6.22A.75.75 0 0 0 6 7.9a4 4 0 1 0 1.477 7.718l-.344-1.489A2.5 2.5 0 1 1 6.039 9.4l-.008-.032h8.927z\"/></svg>";
|
|
2303
|
-
|
|
2304
|
-
var undo = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m5.042 9.367 2.189 1.837a.75.75 0 0 1-.965 1.149l-3.788-3.18a.747.747 0 0 1-.21-.284.75.75 0 0 1 .17-.945L6.23 4.762a.75.75 0 1 1 .964 1.15L4.863 7.866h8.917A.75.75 0 0 1 14 7.9a4 4 0 1 1-1.477 7.718l.344-1.489a2.5 2.5 0 1 0 1.094-4.73l.008-.032H5.042z\"/></svg>";
|
|
2305
|
-
|
|
2306
|
-
var bulletedList = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zm-6 0C1 4.784 1.777 4 2.75 4c.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75C1.784 7.5 1 6.723 1 5.75zm6 9c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zm-6 0c0-.966.777-1.75 1.75-1.75.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75-.966 0-1.75-.777-1.75-1.75z\"/></svg>";
|
|
2307
|
-
|
|
2308
|
-
var numberedList = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM3.5 3v5H2V3.7H1v-1h2.5V3zM.343 17.857l2.59-3.257H2.92a.6.6 0 1 0-1.04 0H.302a2 2 0 1 1 3.995 0h-.001c-.048.405-.16.734-.333.988-.175.254-.59.692-1.244 1.312H4.3v1h-4l.043-.043zM7 14.75a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75z\"/></svg>";
|
|
2309
|
-
|
|
2310
|
-
var todoList = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m2.315 14.705 2.224-2.24a.689.689 0 0 1 .963 0 .664.664 0 0 1 0 .949L2.865 16.07a.682.682 0 0 1-.112.089.647.647 0 0 1-.852-.051L.688 14.886a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0l.717.722zm5.185.045a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75zM2.329 5.745l2.21-2.226a.689.689 0 0 1 .963 0 .664.664 0 0 1 0 .95L2.865 7.125a.685.685 0 0 1-.496.196.644.644 0 0 1-.468-.187L.688 5.912a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0l.73.736zM7.5 5.75A.75.75 0 0 1 8.25 5h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75z\"/></svg>";
|
|
2311
|
-
|
|
2312
|
-
var codeBlock = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M12.87 12.61a.75.75 0 0 1-.089.976l-.085.07-3.154 2.254 3.412 2.414a.75.75 0 0 1 .237.95l-.057.095a.75.75 0 0 1-.95.237l-.096-.058-4.272-3.022-.003-1.223 4.01-2.867a.75.75 0 0 1 1.047.174zm2.795-.231.095.057 4.011 2.867-.003 1.223-4.272 3.022-.095.058a.75.75 0 0 1-.88-.151l-.07-.086-.058-.095a.75.75 0 0 1 .15-.88l.087-.07 3.412-2.414-3.154-2.253-.085-.071a.75.75 0 0 1 .862-1.207zM16 0a2 2 0 0 1 2 2v9.354l-.663-.492-.837-.001V2a.5.5 0 0 0-.5-.5H2a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h3.118L7.156 19H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h14zM5.009 15l.003 1H3v-1h2.009zm2.188-2-1.471 1H5v-1h2.197zM10 11v.095L8.668 12H7v-1h3zm4-2v1H7V9h7zm0-2v1H7V7h7zm-4-2v1H5V5h5zM6 3v1H3V3h3z\"/></svg>";
|
|
2313
|
-
|
|
2314
|
-
var browseFiles = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M11.627 16.5zm5.873-.196zm0-7.001V8h-13v8.5h4.341c.191.54.457 1.044.785 1.5H2a1.5 1.5 0 0 1-1.5-1.5v-13A1.5 1.5 0 0 1 2 2h4.5a1.5 1.5 0 0 1 1.06.44L9.122 4H16a1.5 1.5 0 0 1 1.5 1.5v1A1.5 1.5 0 0 1 19 8v2.531a6.027 6.027 0 0 0-1.5-1.228zM16 6.5v-1H8.5l-2-2H2v13h1V8a1.5 1.5 0 0 1 1.5-1.5H16z\"/><path d=\"M14.5 19.5a5 5 0 1 1 0-10 5 5 0 0 1 0 10zM15 14v-2h-1v2h-2v1h2v2h1v-2h2v-1h-2z\"/></svg>";
|
|
2315
|
-
|
|
2316
|
-
var heading1 = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M19 9v10h-2v-8h-2V9h4zM4 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1H10a1 1 0 0 1-1-1V11H4v4.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1H3a1 1 0 0 1 1 1v4.5z\"/></svg>";
|
|
2317
|
-
|
|
2318
|
-
var heading2 = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M3 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V11H3v4.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1H2a1 1 0 0 1 1 1v4.5zm16.076 8.343V18.5h-6.252c.067-.626.27-1.22.61-1.78.338-.561 1.006-1.305 2.005-2.232.804-.749 1.297-1.257 1.479-1.523.245-.368.368-.732.368-1.092 0-.398-.107-.703-.32-.917-.214-.214-.51-.32-.886-.32-.372 0-.669.111-.889.336-.22.224-.347.596-.38 1.117l-1.778-.178c.106-.982.438-1.686.997-2.114.558-.427 1.257-.64 2.095-.64.918 0 1.64.247 2.164.742.525.495.787 1.11.787 1.847 0 .419-.075.818-.225 1.197-.15.378-.388.775-.714 1.19-.216.275-.605.67-1.168 1.187-.563.516-.92.859-1.07 1.028a3.11 3.11 0 0 0-.365.495h3.542z\"/></svg>";
|
|
2319
|
-
|
|
2320
|
-
var heading3 = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M3 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V11H3v4.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1H2a1 1 0 0 1 1 1v4.5zm9.989 7.53 1.726-.209c.055.44.203.777.445 1.01.24.232.533.349.876.349.368 0 .678-.14.93-.42.251-.279.377-.655.377-1.13 0-.448-.12-.803-.362-1.066a1.153 1.153 0 0 0-.882-.393c-.228 0-.501.044-.819.133l.197-1.453c.482.012.85-.092 1.105-.315.253-.222.38-.517.38-.885 0-.313-.093-.563-.279-.75-.186-.185-.434-.278-.743-.278a1.07 1.07 0 0 0-.78.317c-.216.212-.347.52-.394.927l-1.644-.28c.114-.562.287-1.012.517-1.348.231-.337.553-.601.965-.794a3.24 3.24 0 0 1 1.387-.289c.876 0 1.579.28 2.108.838.436.457.653.973.653 1.549 0 .817-.446 1.468-1.339 1.955.533.114.96.37 1.28.768.319.398.478.878.478 1.441 0 .817-.298 1.513-.895 2.088-.596.576-1.339.864-2.228.864-.842 0-1.54-.243-2.094-.727-.555-.485-.876-1.118-.965-1.901z\"/></svg>";
|
|
2321
|
-
|
|
2322
|
-
var heading4 = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M3.5 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V11h-5v4.5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v4.5zm13.55 10v-1.873h-3.81v-1.561l4.037-5.91h1.498v5.904h1.156v1.567h-1.156V18.5H17.05zm0-3.44v-3.18l-2.14 3.18h2.14z\"/></svg>";
|
|
2323
|
-
|
|
2324
|
-
var heading5 = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M3.5 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V11h-5v4.5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v4.5zm9.578 7.607 1.777-.184c.05.402.201.72.45.955a1.223 1.223 0 0 0 1.81-.101c.258-.303.387-.759.387-1.368 0-.572-.128-1-.384-1.286-.256-.285-.59-.428-1-.428-.512 0-.971.226-1.377.679l-1.448-.21.915-4.843h4.716v1.67H15.56l-.28 1.58a2.697 2.697 0 0 1 1.219-.298 2.68 2.68 0 0 1 2.012.863c.55.576.825 1.323.825 2.241a3.36 3.36 0 0 1-.666 2.05c-.605.821-1.445 1.232-2.52 1.232-.86 0-1.56-.23-2.101-.692-.542-.461-.866-1.081-.971-1.86z\"/></svg>";
|
|
2325
|
-
|
|
2326
|
-
var heading6 = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M3.5 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V11h-5v4.5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v4.5zm15.595 2.973-1.726.19c-.043-.355-.153-.617-.33-.787-.178-.169-.409-.253-.692-.253-.377 0-.695.169-.956.507-.26.339-.424 1.043-.492 2.114.445-.525.997-.787 1.657-.787.745 0 1.383.284 1.914.85.531.568.797 1.3.797 2.197 0 .952-.28 1.716-.838 2.291-.559.576-1.276.864-2.152.864-.94 0-1.712-.365-2.317-1.095-.605-.73-.908-1.927-.908-3.59 0-1.705.316-2.935.946-3.688.63-.753 1.45-1.13 2.457-1.13.706 0 1.291.198 1.755.594.463.395.758.97.885 1.723zm-4.043 3.891c0 .58.133 1.028.4 1.343.266.315.57.473.914.473.33 0 .605-.13.825-.388.22-.258.33-.68.33-1.27 0-.604-.118-1.047-.355-1.329a1.115 1.115 0 0 0-.89-.422c-.342 0-.632.134-.869.403s-.355.666-.355 1.19z\"/></svg>";
|
|
2327
|
-
|
|
2328
|
-
var horizontalLine = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M2 9h16v2H2z\"/></svg>";
|
|
2329
|
-
|
|
2330
|
-
var html = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M17 0a2 2 0 0 1 2 2v7a1 1 0 0 1 1 1v5a1 1 0 0 1-.883.993l-.118.006L19 17a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2l-.001-1.001-.116-.006A1 1 0 0 1 0 15v-5a1 1 0 0 1 .999-1L1 2a2 2 0 0 1 2-2h14zm.499 15.999h-15L2.5 17a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5l-.001-1.001zm-3.478-6.013-.014.014H14v.007l-1.525 1.525-1.46-1.46-.015.013V10h-1v5h1v-3.53l1.428 1.43.048.043.131-.129L14 11.421V15h1v-5h-.965l-.014-.014zM2 10H1v5h1v-2h2v2h1v-5H4v2H2v-2zm7 0H6v1h1v4h1v-4h1v-1zm8 0h-1v5h3v-1h-2v-4zm0-8.5H3a.5.5 0 0 0-.5.5l-.001 6.999h15L17.5 2a.5.5 0 0 0-.5-.5zM10 7v1H4V7h6zm3-2v1H4V5h9zm-3-2v1H4V3h6z\"/></svg>";
|
|
2331
|
-
|
|
2332
|
-
var indent = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zM1.632 6.95 5.02 9.358a.4.4 0 0 1-.013.661l-3.39 2.207A.4.4 0 0 1 1 11.892V7.275a.4.4 0 0 1 .632-.326z\"/></svg>";
|
|
2333
|
-
|
|
2334
|
-
var outdent = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zm1.618-9.55L.98 9.358a.4.4 0 0 0 .013.661l3.39 2.207A.4.4 0 0 0 5 11.892V7.275a.4.4 0 0 0-.632-.326z\"/></svg>";
|
|
2335
|
-
|
|
2336
|
-
var table = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M3 5.5v3h4v-3H3Zm0 4v3h4v-3H3Zm0 4v3h4v-3H3Zm5 3h4v-3H8v3Zm5 0h4v-3h-4v3Zm4-4v-3h-4v3h4Zm0-4v-3h-4v3h4Zm1.5 8A1.5 1.5 0 0 1 17 18H3a1.5 1.5 0 0 1-1.5-1.5V3c.222-.863 1.068-1.5 2-1.5h13c.932 0 1.778.637 2 1.5v13.5Zm-6.5-4v-3H8v3h4Zm0-4v-3H8v3h4Z\"/></svg>";
|
|
2337
|
-
|
|
2338
|
-
/**
|
|
2339
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
2340
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
2341
|
-
*/
|
|
2342
|
-
/**
|
|
2343
|
-
* @module core
|
|
2344
|
-
*/
|
|
2345
|
-
const icons = {
|
|
2346
|
-
bold,
|
|
2347
|
-
cancel,
|
|
2348
|
-
caption,
|
|
2349
|
-
check,
|
|
2350
|
-
cog,
|
|
2351
|
-
colorPalette,
|
|
2352
|
-
eraser,
|
|
2353
|
-
history,
|
|
2354
|
-
image,
|
|
2355
|
-
imageUpload,
|
|
2356
|
-
imageAssetManager,
|
|
2357
|
-
imageUrl,
|
|
2358
|
-
lowVision,
|
|
2359
|
-
textAlternative,
|
|
2360
|
-
loupe,
|
|
2361
|
-
previousArrow,
|
|
2362
|
-
nextArrow,
|
|
2363
|
-
importExport,
|
|
2364
|
-
paragraph,
|
|
2365
|
-
plus,
|
|
2366
|
-
text,
|
|
2367
|
-
alignBottom,
|
|
2368
|
-
alignMiddle,
|
|
2369
|
-
alignTop,
|
|
2370
|
-
alignLeft,
|
|
2371
|
-
alignCenter,
|
|
2372
|
-
alignRight,
|
|
2373
|
-
alignJustify,
|
|
2374
|
-
objectLeft,
|
|
2375
|
-
objectCenter,
|
|
2376
|
-
objectRight,
|
|
2377
|
-
objectFullWidth,
|
|
2378
|
-
objectInline,
|
|
2379
|
-
objectBlockLeft,
|
|
2380
|
-
objectBlockRight,
|
|
2381
|
-
objectSizeFull,
|
|
2382
|
-
objectSizeLarge,
|
|
2383
|
-
objectSizeSmall,
|
|
2384
|
-
objectSizeMedium,
|
|
2385
|
-
pencil,
|
|
2386
|
-
pilcrow,
|
|
2387
|
-
quote,
|
|
2388
|
-
threeVerticalDots,
|
|
2389
|
-
dragIndicator,
|
|
2390
|
-
redo,
|
|
2391
|
-
undo,
|
|
2392
|
-
bulletedList,
|
|
2393
|
-
numberedList,
|
|
2394
|
-
todoList,
|
|
2395
|
-
codeBlock,
|
|
2396
|
-
browseFiles,
|
|
2397
|
-
heading1,
|
|
2398
|
-
heading2,
|
|
2399
|
-
heading3,
|
|
2400
|
-
heading4,
|
|
2401
|
-
heading5,
|
|
2402
|
-
heading6,
|
|
2403
|
-
horizontalLine,
|
|
2404
|
-
html,
|
|
2405
|
-
indent,
|
|
2406
|
-
outdent,
|
|
2407
|
-
table
|
|
2408
|
-
};
|
|
2409
|
-
|
|
2410
|
-
export { Command, Context, ContextPlugin, DataApiMixin, Editor, ElementApiMixin, MultiCommand, PendingActions, Plugin, attachToForm, icons, secureSourceElement };
|
|
2411
|
-
//# sourceMappingURL=index.js.map
|