@ckeditor/ckeditor5-core 48.2.0 → 48.3.0-alpha.1
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/accessibility.d.ts +339 -339
- package/dist/augmentation.d.ts +8 -8
- package/dist/command.d.ts +188 -191
- package/dist/commandcollection.d.ts +76 -76
- package/dist/context.d.ts +238 -238
- package/dist/contextplugin.d.ts +57 -60
- package/dist/editingkeystrokehandler.d.ts +49 -49
- package/dist/editor/editor.d.ts +538 -576
- package/dist/editor/editorconfig.d.ts +1674 -1634
- package/dist/editor/utils/attachtoform.d.ts +12 -12
- package/dist/editor/utils/editorusagedata.d.ts +51 -51
- package/dist/editor/utils/elementapimixin.d.ts +39 -29
- package/dist/editor/utils/normalizerootsconfig.d.ts +65 -65
- package/dist/editor/utils/registerandinitializerootconfigattributes.d.ts +16 -12
- package/dist/editor/utils/rootacceptsblocks.d.ts +13 -13
- package/dist/editor/utils/securesourceelement.d.ts +13 -13
- package/dist/editor/utils/verifyrootelements.d.ts +8 -8
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +27 -27
- package/dist/index.js +3416 -3459
- package/dist/index.js.map +1 -1
- package/dist/legacyerrors.d.ts +0 -4
- package/dist/multicommand.d.ts +61 -61
- package/dist/pendingactions.d.ts +111 -111
- package/dist/plugin.d.ts +291 -283
- package/dist/plugincollection.d.ts +109 -108
- package/dist/translations/af.js +1 -1
- package/dist/translations/af.umd.js +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/be.js +1 -1
- package/dist/translations/be.umd.js +1 -1
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/bs.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de-ch.js +1 -1
- package/dist/translations/de-ch.umd.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/eu.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/gu.js +1 -1
- package/dist/translations/gu.umd.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/hy.js +1 -1
- package/dist/translations/hy.umd.js +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/jv.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/km.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.js +1 -1
- package/dist/translations/ku.umd.js +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nb.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.js +1 -1
- package/dist/translations/ne.umd.js +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/oc.js +1 -1
- package/dist/translations/oc.umd.js +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/si.js +1 -1
- package/dist/translations/si.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/dist/typings.d.ts +10 -7
- package/package.json +5 -5
package/dist/context.d.ts
CHANGED
|
@@ -1,245 +1,245 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { Config, Collection, Locale, type LocaleTranslate } from
|
|
9
|
-
import { PluginCollection } from
|
|
10
|
-
import { type Editor } from
|
|
11
|
-
import type { LoadedPlugins, PluginConstructor } from
|
|
12
|
-
import type { EditorConfig } from
|
|
6
|
+
* @module core/context
|
|
7
|
+
*/
|
|
8
|
+
import { Config, Collection, Locale, type LocaleTranslate } from "@ckeditor/ckeditor5-utils";
|
|
9
|
+
import { PluginCollection } from "./plugincollection.js";
|
|
10
|
+
import { type Editor } from "./editor/editor.js";
|
|
11
|
+
import type { LoadedPlugins, PluginConstructor } from "./plugin.js";
|
|
12
|
+
import type { EditorConfig } from "./editor/editorconfig.js";
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
14
|
+
* Provides a common, higher-level environment for solutions that use multiple {@link module:core/editor/editor~Editor editors}
|
|
15
|
+
* or plugins that work outside the editor. Use it instead of {@link module:core/editor/editor~Editor.create `Editor.create()`}
|
|
16
|
+
* in advanced application integrations.
|
|
17
|
+
*
|
|
18
|
+
* All configuration options passed to a context will be used as default options for the editor instances initialized in that context.
|
|
19
|
+
*
|
|
20
|
+
* {@link module:core/contextplugin~ContextPlugin Context plugins} passed to a context instance will be shared among all
|
|
21
|
+
* editor instances initialized in this context. These will be the same plugin instances for all the editors.
|
|
22
|
+
*
|
|
23
|
+
* **Note:** The context can only be initialized with {@link module:core/contextplugin~ContextPlugin context plugins}
|
|
24
|
+
* (e.g. [comments](https://ckeditor.com/collaboration/comments/)). Regular {@link module:core/plugin~Plugin plugins} require an
|
|
25
|
+
* editor instance to work and cannot be added to a context.
|
|
26
|
+
*
|
|
27
|
+
* **Note:** You can add a context plugin to an editor instance, though.
|
|
28
|
+
*
|
|
29
|
+
* If you are using multiple editor instances on one page and use any context plugins, create a context to share the configuration and
|
|
30
|
+
* plugins among these editors. Some plugins will use the information about all existing editors to better integrate between them.
|
|
31
|
+
*
|
|
32
|
+
* If you are using plugins that do not require an editor to work (e.g. [comments](https://ckeditor.com/collaboration/comments/)),
|
|
33
|
+
* enable and configure them using the context.
|
|
34
|
+
*
|
|
35
|
+
* If you are using only a single editor on each page, use {@link module:core/editor/editor~Editor.create `Editor.create()`} instead.
|
|
36
|
+
* In such a case, a context instance will be created by the editor instance in a transparent way.
|
|
37
|
+
*
|
|
38
|
+
* See {@link ~Context.create `Context.create()`} for usage examples.
|
|
39
|
+
*/
|
|
40
40
|
export declare class Context {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Stores all the configurations specific to this context instance.
|
|
43
|
+
*/
|
|
44
|
+
readonly config: Config<ContextConfig>;
|
|
45
|
+
/**
|
|
46
|
+
* The plugins loaded and in use by this context instance.
|
|
47
|
+
*/
|
|
48
|
+
readonly plugins: PluginCollection<Context | Editor>;
|
|
49
|
+
readonly locale: Locale;
|
|
50
|
+
/**
|
|
51
|
+
* Shorthand for {@link module:utils/locale~Locale#t}.
|
|
52
|
+
*/
|
|
53
|
+
readonly t: LocaleTranslate;
|
|
54
|
+
/**
|
|
55
|
+
* A list of editors that this context instance is injected to.
|
|
56
|
+
*/
|
|
57
|
+
readonly editors: Collection<Editor>;
|
|
58
|
+
/**
|
|
59
|
+
* The default configuration which is built into the `Context` class.
|
|
60
|
+
*
|
|
61
|
+
* It was used in the now deprecated CKEditor 5 builds featuring `Context` to provide the default configuration options
|
|
62
|
+
* which are later used during the context initialization.
|
|
63
|
+
*
|
|
64
|
+
* ```ts
|
|
65
|
+
* Context.defaultConfig = {
|
|
66
|
+
* foo: 1,
|
|
67
|
+
* bar: 2
|
|
68
|
+
* };
|
|
69
|
+
*
|
|
70
|
+
* Context
|
|
71
|
+
* .create()
|
|
72
|
+
* .then( context => {
|
|
73
|
+
* context.config.get( 'foo' ); // -> 1
|
|
74
|
+
* context.config.get( 'bar' ); // -> 2
|
|
75
|
+
* } );
|
|
76
|
+
*
|
|
77
|
+
* // The default options can be overridden by the configuration passed to create().
|
|
78
|
+
* Context
|
|
79
|
+
* .create( { bar: 3 } )
|
|
80
|
+
* .then( context => {
|
|
81
|
+
* context.config.get( 'foo' ); // -> 1
|
|
82
|
+
* context.config.get( 'bar' ); // -> 3
|
|
83
|
+
* } );
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* See also {@link module:core/context~Context.builtinPlugins `Context.builtinPlugins`}
|
|
87
|
+
* and {@link module:core/editor/editor~Editor.defaultConfig `Editor.defaultConfig`}.
|
|
88
|
+
*/
|
|
89
|
+
static defaultConfig: ContextConfig;
|
|
90
|
+
/**
|
|
91
|
+
* An array of plugins built into the `Context` class.
|
|
92
|
+
*
|
|
93
|
+
* It was used in the now deprecated CKEditor 5 builds featuring `Context` to provide the default configuration options
|
|
94
|
+
* which are later used during the context initialization.
|
|
95
|
+
*
|
|
96
|
+
* They will be automatically initialized by `Context` unless `config.plugins` is passed.
|
|
97
|
+
*
|
|
98
|
+
* ```ts
|
|
99
|
+
* // Build some context plugins into the Context class first.
|
|
100
|
+
* Context.builtinPlugins = [ FooPlugin, BarPlugin ];
|
|
101
|
+
*
|
|
102
|
+
* // Normally, you need to define config.plugins, but since Context.builtinPlugins was
|
|
103
|
+
* // defined, now you can call create() without any configuration.
|
|
104
|
+
* Context
|
|
105
|
+
* .create()
|
|
106
|
+
* .then( context => {
|
|
107
|
+
* context.plugins.get( FooPlugin ); // -> An instance of the Foo plugin.
|
|
108
|
+
* context.plugins.get( BarPlugin ); // -> An instance of the Bar plugin.
|
|
109
|
+
* } );
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* See also {@link module:core/context~Context.defaultConfig `Context.defaultConfig`}
|
|
113
|
+
* and {@link module:core/editor/editor~Editor.builtinPlugins `Editor.builtinPlugins`}.
|
|
114
|
+
*/
|
|
115
|
+
static builtinPlugins: Array<PluginConstructor<Context | Editor>>;
|
|
116
|
+
/**
|
|
117
|
+
* Reference to the editor which created the context.
|
|
118
|
+
* Null when the context was created outside of the editor.
|
|
119
|
+
*
|
|
120
|
+
* It is used to destroy the context when removing the editor that has created the context.
|
|
121
|
+
*/
|
|
122
|
+
private _contextOwner;
|
|
123
|
+
/**
|
|
124
|
+
* Creates a context instance with a given configuration.
|
|
125
|
+
*
|
|
126
|
+
* Usually not to be used directly. See the static {@link module:core/context~Context.create `create()`} method.
|
|
127
|
+
*
|
|
128
|
+
* @param config The context configuration.
|
|
129
|
+
*/
|
|
130
|
+
constructor(config?: ContextConfig);
|
|
131
|
+
/**
|
|
132
|
+
* Loads and initializes plugins specified in the configuration.
|
|
133
|
+
*
|
|
134
|
+
* @returns A promise which resolves once the initialization is completed, providing an array of loaded plugins.
|
|
135
|
+
*/
|
|
136
|
+
initPlugins(): Promise<LoadedPlugins>;
|
|
137
|
+
/**
|
|
138
|
+
* Destroys the context instance and all editors used with the context,
|
|
139
|
+
* releasing all resources used by the context.
|
|
140
|
+
*
|
|
141
|
+
* @returns A promise that resolves once the context instance is fully destroyed.
|
|
142
|
+
*/
|
|
143
|
+
destroy(): Promise<unknown>;
|
|
144
|
+
/**
|
|
145
|
+
* Adds a reference to the editor which is used with this context.
|
|
146
|
+
*
|
|
147
|
+
* When the given editor has created the context, the reference to this editor will be stored
|
|
148
|
+
* as a {@link ~Context#_contextOwner}.
|
|
149
|
+
*
|
|
150
|
+
* This method should only be used by the editor.
|
|
151
|
+
*
|
|
152
|
+
* @internal
|
|
153
|
+
* @param isContextOwner Stores the given editor as a context owner.
|
|
154
|
+
*/
|
|
155
|
+
_addEditor(editor: Editor, isContextOwner: boolean): void;
|
|
156
|
+
/**
|
|
157
|
+
* Removes a reference to the editor which was used with this context.
|
|
158
|
+
* When the context was created by the given editor, the context will be destroyed.
|
|
159
|
+
*
|
|
160
|
+
* This method should only be used by the editor.
|
|
161
|
+
*
|
|
162
|
+
* @internal
|
|
163
|
+
* @return A promise that resolves once the editor is removed from the context or when the context was destroyed.
|
|
164
|
+
*/
|
|
165
|
+
_removeEditor(editor: Editor): Promise<unknown>;
|
|
166
|
+
/**
|
|
167
|
+
* Returns the context configuration which will be copied to the editors created using this context.
|
|
168
|
+
*
|
|
169
|
+
* The configuration returned by this method has the plugins configuration removed – plugins are shared with all editors
|
|
170
|
+
* through another mechanism.
|
|
171
|
+
*
|
|
172
|
+
* This method should only be used by the editor.
|
|
173
|
+
*
|
|
174
|
+
* @internal
|
|
175
|
+
* @returns Configuration as a plain object.
|
|
176
|
+
*/
|
|
177
|
+
_getEditorConfig(): Partial<EditorConfig>;
|
|
178
|
+
/**
|
|
179
|
+
* Creates and initializes a new context instance.
|
|
180
|
+
*
|
|
181
|
+
* ```ts
|
|
182
|
+
* const commonConfig = { ... }; // Configuration for all the plugins and editors.
|
|
183
|
+
* const editorPlugins = [ ... ]; // Regular plugins here.
|
|
184
|
+
*
|
|
185
|
+
* Context
|
|
186
|
+
* .create( {
|
|
187
|
+
* // Only context plugins here.
|
|
188
|
+
* plugins: [ ... ],
|
|
189
|
+
*
|
|
190
|
+
* // Configure the language for all the editors (it cannot be overwritten).
|
|
191
|
+
* language: { ... },
|
|
192
|
+
*
|
|
193
|
+
* // Configuration for context plugins.
|
|
194
|
+
* comments: { ... },
|
|
195
|
+
* ...
|
|
196
|
+
*
|
|
197
|
+
* // Default configuration for editor plugins.
|
|
198
|
+
* toolbar: { ... },
|
|
199
|
+
* image: { ... },
|
|
200
|
+
* ...
|
|
201
|
+
* } )
|
|
202
|
+
* .then( context => {
|
|
203
|
+
* const promises = [];
|
|
204
|
+
*
|
|
205
|
+
* promises.push( ClassicEditor.create(
|
|
206
|
+
* document.getElementById( 'editor1' ),
|
|
207
|
+
* {
|
|
208
|
+
* editorPlugins,
|
|
209
|
+
* context
|
|
210
|
+
* }
|
|
211
|
+
* ) );
|
|
212
|
+
*
|
|
213
|
+
* promises.push( ClassicEditor.create(
|
|
214
|
+
* document.getElementById( 'editor2' ),
|
|
215
|
+
* {
|
|
216
|
+
* editorPlugins,
|
|
217
|
+
* context,
|
|
218
|
+
* toolbar: { ... } // You can overwrite the configuration of the context.
|
|
219
|
+
* }
|
|
220
|
+
* ) );
|
|
221
|
+
*
|
|
222
|
+
* return Promise.all( promises );
|
|
223
|
+
* } );
|
|
224
|
+
* ```
|
|
225
|
+
*
|
|
226
|
+
* @param config The context configuration.
|
|
227
|
+
* @returns A promise resolved once the context is ready. The promise resolves with the created context instance.
|
|
228
|
+
*/
|
|
229
|
+
static create(config?: ContextConfig): Promise<Context>;
|
|
230
|
+
/**
|
|
231
|
+
* `Context` class is commonly put in `config.plugins` array.
|
|
232
|
+
*
|
|
233
|
+
* This property helps with better error detection.
|
|
234
|
+
*
|
|
235
|
+
* @internal
|
|
236
|
+
*/
|
|
237
|
+
static get _throwErrorWhenUsedAsAPlugin(): true;
|
|
238
238
|
}
|
|
239
239
|
/**
|
|
240
|
-
|
|
241
|
-
|
|
240
|
+
* The context configuration.
|
|
241
|
+
*/
|
|
242
242
|
export type ContextConfig = {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
} & Omit<EditorConfig,
|
|
243
|
+
plugins?: Array<PluginConstructor<Context | Editor>>;
|
|
244
|
+
substitutePlugins?: Array<PluginConstructor<Context | Editor>>;
|
|
245
|
+
} & Omit<EditorConfig, "plugins" | "substitutePlugins" | "removePlugins" | "extraPlugins">;
|
package/dist/contextplugin.d.ts
CHANGED
|
@@ -1,69 +1,66 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { type Collection, type Config, type Locale, type LocaleTranslate } from
|
|
9
|
-
import { type Editor } from
|
|
10
|
-
import type { EditorConfig } from
|
|
11
|
-
import { type Context } from
|
|
12
|
-
import type { PluginDependencies, PluginInterface } from
|
|
13
|
-
import { type PluginCollection } from
|
|
14
|
-
declare const
|
|
15
|
-
new (): import("@ckeditor/ckeditor5-utils").Observable;
|
|
16
|
-
prototype: import("@ckeditor/ckeditor5-utils").Observable;
|
|
17
|
-
};
|
|
6
|
+
* @module core/contextplugin
|
|
7
|
+
*/
|
|
8
|
+
import { type Collection, type Config, type Locale, type LocaleTranslate, type ObservableMixinConstructor } from "@ckeditor/ckeditor5-utils";
|
|
9
|
+
import { type Editor } from "./editor/editor.js";
|
|
10
|
+
import type { EditorConfig } from "./editor/editorconfig.js";
|
|
11
|
+
import { type Context } from "./context.js";
|
|
12
|
+
import type { PluginDependencies, PluginInterface } from "./plugin.js";
|
|
13
|
+
import { type PluginCollection } from "./plugincollection.js";
|
|
14
|
+
declare const ContextPluginBase: ObservableMixinConstructor;
|
|
18
15
|
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export declare class ContextPlugin extends
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
16
|
+
* The base class for {@link module:core/context~Context} plugin classes.
|
|
17
|
+
*
|
|
18
|
+
* A context plugin can either be initialized for an {@link module:core/editor/editor~Editor editor} or for
|
|
19
|
+
* a {@link module:core/context~Context context}. In other words, it can either
|
|
20
|
+
* work within one editor instance or with one or more editor instances that use a single context.
|
|
21
|
+
* It is the context plugin's role to implement handling for both modes.
|
|
22
|
+
*
|
|
23
|
+
* There are a few rules for interaction between the editor plugins and context plugins:
|
|
24
|
+
*
|
|
25
|
+
* * A context plugin can require another context plugin.
|
|
26
|
+
* * An {@link module:core/plugin~Plugin editor plugin} can require a context plugin.
|
|
27
|
+
* * A context plugin MUST NOT require an {@link module:core/plugin~Plugin editor plugin}.
|
|
28
|
+
*/
|
|
29
|
+
export declare class ContextPlugin extends ContextPluginBase implements PluginInterface {
|
|
30
|
+
/**
|
|
31
|
+
* The context or editor instance.
|
|
32
|
+
*/
|
|
33
|
+
readonly context: ContextInterface;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new plugin instance.
|
|
36
|
+
*/
|
|
37
|
+
constructor(context: Context | Editor);
|
|
38
|
+
/**
|
|
39
|
+
* @inheritDoc
|
|
40
|
+
*/
|
|
41
|
+
destroy(): void;
|
|
42
|
+
/**
|
|
43
|
+
* @inheritDoc
|
|
44
|
+
*/
|
|
45
|
+
static get isContextPlugin(): true;
|
|
46
|
+
/**
|
|
47
|
+
* @inheritDoc
|
|
48
|
+
*/
|
|
49
|
+
static get isOfficialPlugin(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* @inheritDoc
|
|
52
|
+
*/
|
|
53
|
+
static get isPremiumPlugin(): boolean;
|
|
57
54
|
}
|
|
58
55
|
/**
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
* The common interface of {@link module:core/context~Context} and {@link module:core/editor/editor~Editor}.
|
|
57
|
+
*/
|
|
61
58
|
export interface ContextInterface {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
config: Config<Omit<EditorConfig, "plugins" | "substitutePlugins" | "removePlugins" | "extraPlugins">>;
|
|
60
|
+
plugins: PluginCollection<Context | Editor>;
|
|
61
|
+
locale: Locale;
|
|
62
|
+
t: LocaleTranslate;
|
|
63
|
+
editors?: Collection<Editor>;
|
|
67
64
|
}
|
|
68
65
|
export type ContextPluginDependencies = PluginDependencies<Context | Editor>;
|
|
69
66
|
export {};
|