@ckeditor/ckeditor5-core 47.6.1 → 48.0.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/LICENSE.md +1 -1
- package/{src → dist}/editor/editorconfig.d.ts +295 -20
- package/dist/editor/utils/normalizerootsconfig.d.ts +50 -0
- package/dist/index-content.css +10 -10
- package/dist/index-editor.css +5 -5
- package/dist/index.css +10 -16
- package/dist/index.css.map +1 -1
- package/{src → dist}/index.d.ts +2 -1
- package/dist/index.js +161 -6
- package/dist/index.js.map +1 -1
- package/package.json +23 -43
- package/lang/contexts.json +0 -38
- package/lang/translations/af.po +0 -156
- package/lang/translations/ar.po +0 -156
- package/lang/translations/ast.po +0 -156
- package/lang/translations/az.po +0 -156
- package/lang/translations/be.po +0 -156
- package/lang/translations/bg.po +0 -156
- package/lang/translations/bn.po +0 -156
- package/lang/translations/bs.po +0 -156
- package/lang/translations/ca.po +0 -156
- package/lang/translations/cs.po +0 -156
- package/lang/translations/da.po +0 -156
- package/lang/translations/de-ch.po +0 -156
- package/lang/translations/de.po +0 -156
- package/lang/translations/el.po +0 -156
- package/lang/translations/en-au.po +0 -156
- package/lang/translations/en-gb.po +0 -156
- package/lang/translations/en.po +0 -156
- package/lang/translations/eo.po +0 -156
- package/lang/translations/es-co.po +0 -156
- package/lang/translations/es.po +0 -156
- package/lang/translations/et.po +0 -156
- package/lang/translations/eu.po +0 -156
- package/lang/translations/fa.po +0 -156
- package/lang/translations/fi.po +0 -156
- package/lang/translations/fr.po +0 -156
- package/lang/translations/gl.po +0 -156
- package/lang/translations/gu.po +0 -156
- package/lang/translations/he.po +0 -156
- package/lang/translations/hi.po +0 -156
- package/lang/translations/hr.po +0 -156
- package/lang/translations/hu.po +0 -156
- package/lang/translations/hy.po +0 -156
- package/lang/translations/id.po +0 -156
- package/lang/translations/it.po +0 -156
- package/lang/translations/ja.po +0 -156
- package/lang/translations/jv.po +0 -156
- package/lang/translations/kk.po +0 -156
- package/lang/translations/km.po +0 -156
- package/lang/translations/kn.po +0 -156
- package/lang/translations/ko.po +0 -156
- package/lang/translations/ku.po +0 -156
- package/lang/translations/lt.po +0 -156
- package/lang/translations/lv.po +0 -156
- package/lang/translations/ms.po +0 -156
- package/lang/translations/nb.po +0 -156
- package/lang/translations/ne.po +0 -156
- package/lang/translations/nl.po +0 -156
- package/lang/translations/no.po +0 -156
- package/lang/translations/oc.po +0 -156
- package/lang/translations/pl.po +0 -156
- package/lang/translations/pt-br.po +0 -156
- package/lang/translations/pt.po +0 -156
- package/lang/translations/ro.po +0 -156
- package/lang/translations/ru.po +0 -156
- package/lang/translations/si.po +0 -156
- package/lang/translations/sk.po +0 -156
- package/lang/translations/sl.po +0 -156
- package/lang/translations/sq.po +0 -156
- package/lang/translations/sr-latn.po +0 -156
- package/lang/translations/sr.po +0 -156
- package/lang/translations/sv.po +0 -156
- package/lang/translations/th.po +0 -156
- package/lang/translations/ti.po +0 -156
- package/lang/translations/tk.po +0 -156
- package/lang/translations/tr.po +0 -156
- package/lang/translations/tt.po +0 -156
- package/lang/translations/ug.po +0 -156
- package/lang/translations/uk.po +0 -156
- package/lang/translations/ur.po +0 -156
- package/lang/translations/uz.po +0 -156
- package/lang/translations/vi.po +0 -156
- package/lang/translations/zh-cn.po +0 -156
- package/lang/translations/zh.po +0 -156
- package/src/accessibility.js +0 -332
- package/src/augmentation.js +0 -5
- package/src/command.js +0 -221
- package/src/commandcollection.js +0 -87
- package/src/context.js +0 -315
- package/src/contextplugin.js +0 -59
- package/src/editingkeystrokehandler.js +0 -61
- package/src/editor/editor.js +0 -1010
- package/src/editor/editorconfig.js +0 -5
- package/src/editor/utils/attachtoform.js +0 -57
- package/src/editor/utils/editorusagedata.js +0 -127
- package/src/editor/utils/elementapimixin.js +0 -42
- package/src/editor/utils/securesourceelement.js +0 -35
- package/src/index.js +0 -22
- package/src/multicommand.js +0 -79
- package/src/pendingactions.js +0 -127
- package/src/plugin.js +0 -132
- package/src/plugincollection.js +0 -506
- package/src/typings.js +0 -5
- package/theme/core.css +0 -21
- /package/{src → dist}/accessibility.d.ts +0 -0
- /package/{src → dist}/augmentation.d.ts +0 -0
- /package/{src → dist}/command.d.ts +0 -0
- /package/{src → dist}/commandcollection.d.ts +0 -0
- /package/{src → dist}/context.d.ts +0 -0
- /package/{src → dist}/contextplugin.d.ts +0 -0
- /package/{src → dist}/editingkeystrokehandler.d.ts +0 -0
- /package/{src → dist}/editor/editor.d.ts +0 -0
- /package/{src → dist}/editor/utils/attachtoform.d.ts +0 -0
- /package/{src → dist}/editor/utils/editorusagedata.d.ts +0 -0
- /package/{src → dist}/editor/utils/elementapimixin.d.ts +0 -0
- /package/{src → dist}/editor/utils/securesourceelement.d.ts +0 -0
- /package/{src → dist}/multicommand.d.ts +0 -0
- /package/{src → dist}/pendingactions.d.ts +0 -0
- /package/{src → dist}/plugin.d.ts +0 -0
- /package/{src → dist}/plugincollection.d.ts +0 -0
- /package/{src → dist}/typings.d.ts +0 -0
package/LICENSE.md
CHANGED
|
@@ -18,7 +18,7 @@ Where not otherwise indicated, all CKEditor 5 content is authored by CKSour
|
|
|
18
18
|
|
|
19
19
|
The following libraries are included in CKEditor 5 under the [MIT license](https://opensource.org/licenses/MIT):
|
|
20
20
|
|
|
21
|
-
* es-toolkit - Copyright (c) 2024 Viva Republica, Inc.
|
|
21
|
+
* es-toolkit - Copyright (c) 2024 Viva Republica, Inc and Copyright OpenJS Foundation and other contributors.
|
|
22
22
|
|
|
23
23
|
Trademarks
|
|
24
24
|
----------
|
|
@@ -31,6 +31,26 @@ import type { EngineConfig } from '@ckeditor/ckeditor5-engine';
|
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
33
|
export interface EditorConfig extends EngineConfig {
|
|
34
|
+
/**
|
|
35
|
+
* The DOM element that will be the source for the created editor.
|
|
36
|
+
*
|
|
37
|
+
* **Note:** This option is only available in the {@link module:editor-classic/classiceditor~ClassicEditor}.
|
|
38
|
+
* Other editor types expect configuration for the root elements to be passed in the
|
|
39
|
+
* {@link module:core/editor/editorconfig~EditorConfig#roots `config.roots`} configuration.
|
|
40
|
+
*
|
|
41
|
+
* If a DOM element is passed, its content will be automatically loaded to the editor upon initialization
|
|
42
|
+
* and the {@link module:editor-classic/classiceditorui~ClassicEditorUI#element editor element} will replace the passed element
|
|
43
|
+
* in the DOM (the original one will be hidden and the editor will be injected next to it).
|
|
44
|
+
*
|
|
45
|
+
* If the {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy updateSourceElementOnDestroy}
|
|
46
|
+
* option is set to `true`, the editor data will be set back to the original element once the editor is destroyed and when a form,
|
|
47
|
+
* in which this element is contained, is submitted (if the original element is a `<textarea>`). This ensures seamless integration
|
|
48
|
+
* with native web forms.
|
|
49
|
+
*
|
|
50
|
+
* If the element is not provided, a detached editor will be created. In this case you need to insert it into the DOM manually.
|
|
51
|
+
* It is available under the {@link module:editor-classic/classiceditorui~ClassicEditorUI#element `editor.ui.element`} property.
|
|
52
|
+
*/
|
|
53
|
+
attachTo?: HTMLElement;
|
|
34
54
|
context?: Context;
|
|
35
55
|
/**
|
|
36
56
|
* The list of additional plugins to load along those already available in the
|
|
@@ -98,12 +118,18 @@ export interface EditorConfig extends EngineConfig {
|
|
|
98
118
|
*
|
|
99
119
|
* See also {@link module:core/editor/editor~Editor.create Editor.create()} documentation for the editor implementation which you use.
|
|
100
120
|
*
|
|
101
|
-
* **Note:** If
|
|
102
|
-
*
|
|
121
|
+
* **Note:** If `config.initialData` is set together with `config.root.initialData` or `config.roots.<rootName>.initialData`,
|
|
122
|
+
* an error will be thrown as those options exclude themselves.
|
|
103
123
|
*
|
|
104
124
|
* If `config.initialData` is not set when the editor is initialized, the data received in `Editor.create()` call
|
|
105
125
|
* will be used to set `config.initialData`. As a result, `initialData` is always set in the editor's config and
|
|
106
126
|
* plugins can read and/or modify it during initialization.
|
|
127
|
+
*
|
|
128
|
+
* **This property has been deprecated and will be removed in the future versions of CKEditor. Please use
|
|
129
|
+
* {@link module:core/editor/editorconfig~EditorConfig#root `root.initialData`} or
|
|
130
|
+
* {@link module:core/editor/editorconfig~EditorConfig#roots `roots.<rootName>.initialData`} instead.**
|
|
131
|
+
*
|
|
132
|
+
* @deprecated
|
|
107
133
|
*/
|
|
108
134
|
initialData?: string | Record<string, string>;
|
|
109
135
|
/**
|
|
@@ -113,7 +139,8 @@ export interface EditorConfig extends EngineConfig {
|
|
|
113
139
|
*
|
|
114
140
|
* ```ts
|
|
115
141
|
* ClassicEditor
|
|
116
|
-
* .create(
|
|
142
|
+
* .create( {
|
|
143
|
+
* attachTo: document.querySelector( '#editor' ),
|
|
117
144
|
* // The UI of the editor as well as its content will be in German.
|
|
118
145
|
* language: 'de'
|
|
119
146
|
* } )
|
|
@@ -130,7 +157,8 @@ export interface EditorConfig extends EngineConfig {
|
|
|
130
157
|
*
|
|
131
158
|
* ```ts
|
|
132
159
|
* ClassicEditor
|
|
133
|
-
* .create(
|
|
160
|
+
* .create( {
|
|
161
|
+
* attachTo: document.querySelector( '#editor' ),
|
|
134
162
|
* language: {
|
|
135
163
|
* // The UI will be in English.
|
|
136
164
|
* ui: 'en',
|
|
@@ -169,7 +197,8 @@ export interface EditorConfig extends EngineConfig {
|
|
|
169
197
|
* import { ClassicEditor, Essentials, Paragraph } from 'ckeditor5';
|
|
170
198
|
* import { translations } from 'ckeditor5/dist/translations/pl.js';
|
|
171
199
|
*
|
|
172
|
-
* await ClassicEditor.create(
|
|
200
|
+
* await ClassicEditor.create( {
|
|
201
|
+
* attachTo: document.querySelector( '#editor' ),
|
|
173
202
|
* plugins: [
|
|
174
203
|
* Essentials,
|
|
175
204
|
* Paragraph,
|
|
@@ -190,7 +219,8 @@ export interface EditorConfig extends EngineConfig {
|
|
|
190
219
|
*
|
|
191
220
|
* import 'ckeditor5/dist/styles.css';
|
|
192
221
|
*
|
|
193
|
-
* await ClassicEditor.create(
|
|
222
|
+
* await ClassicEditor.create( {
|
|
223
|
+
* attachTo: document.querySelector( '#editor' ),
|
|
194
224
|
* plugins: [
|
|
195
225
|
* Essentials,
|
|
196
226
|
* Paragraph,
|
|
@@ -218,7 +248,8 @@ export interface EditorConfig extends EngineConfig {
|
|
|
218
248
|
*
|
|
219
249
|
* ```ts
|
|
220
250
|
* ClassicEditor
|
|
221
|
-
* .create(
|
|
251
|
+
* .create( {
|
|
252
|
+
* attachTo: document.querySelector( '#editor' ),
|
|
222
253
|
* menuBar: {
|
|
223
254
|
* isVisible: true
|
|
224
255
|
* }
|
|
@@ -230,7 +261,8 @@ export interface EditorConfig extends EngineConfig {
|
|
|
230
261
|
*
|
|
231
262
|
* ```ts
|
|
232
263
|
* DecoupledEditor
|
|
233
|
-
* .create(
|
|
264
|
+
* .create( {
|
|
265
|
+
* root: { element: document.querySelector( '#editor' ) },
|
|
234
266
|
* toolbar: [ 'undo', 'redo', 'bold', 'italic', 'numberedList', 'bulletedList' ],
|
|
235
267
|
* } )
|
|
236
268
|
* .then( editor => {
|
|
@@ -256,7 +288,8 @@ export interface EditorConfig extends EngineConfig {
|
|
|
256
288
|
*
|
|
257
289
|
* ```ts
|
|
258
290
|
* ClassicEditor
|
|
259
|
-
* .create(
|
|
291
|
+
* .create( {
|
|
292
|
+
* attachTo: document.querySelector( '#editor' ),
|
|
260
293
|
* menuBar: {
|
|
261
294
|
* // Removes "Bold" and "Block quote" buttons from their respective menus.
|
|
262
295
|
* removeItems: [ 'menuBar:bold', 'menuBar:blockQuote' ]
|
|
@@ -269,7 +302,8 @@ export interface EditorConfig extends EngineConfig {
|
|
|
269
302
|
*
|
|
270
303
|
* ```ts
|
|
271
304
|
* ClassicEditor
|
|
272
|
-
* .create(
|
|
305
|
+
* .create( {
|
|
306
|
+
* attachTo: document.querySelector( '#editor' ),
|
|
273
307
|
* menuBar: {
|
|
274
308
|
* // Removes the entire basic styles group ("Bold", "Italic", "Underline", etc.) from the "Format" menu.
|
|
275
309
|
* removeItems: [ 'basicStyles' ]
|
|
@@ -282,7 +316,8 @@ export interface EditorConfig extends EngineConfig {
|
|
|
282
316
|
*
|
|
283
317
|
* ```ts
|
|
284
318
|
* ClassicEditor
|
|
285
|
-
* .create(
|
|
319
|
+
* .create( {
|
|
320
|
+
* attachTo: document.querySelector( '#editor' ),
|
|
286
321
|
* menuBar: {
|
|
287
322
|
* // Removes the whole top-level "Insert" menu from the menu bar.
|
|
288
323
|
* removeItems: [ 'insert' ]
|
|
@@ -323,7 +358,8 @@ export interface EditorConfig extends EngineConfig {
|
|
|
323
358
|
*
|
|
324
359
|
* ```ts
|
|
325
360
|
* ClassicEditor
|
|
326
|
-
* .create(
|
|
361
|
+
* .create( {
|
|
362
|
+
* attachTo: document.querySelector( '#editor' ),
|
|
327
363
|
* menuBar: {
|
|
328
364
|
* addItems: [
|
|
329
365
|
* {
|
|
@@ -353,7 +389,8 @@ export interface EditorConfig extends EngineConfig {
|
|
|
353
389
|
*
|
|
354
390
|
* ```ts
|
|
355
391
|
* ClassicEditor
|
|
356
|
-
* .create(
|
|
392
|
+
* .create( {
|
|
393
|
+
* attachTo: document.querySelector( '#editor' ),
|
|
357
394
|
* menuBar: {
|
|
358
395
|
* addItems: [
|
|
359
396
|
* {
|
|
@@ -376,7 +413,8 @@ export interface EditorConfig extends EngineConfig {
|
|
|
376
413
|
*
|
|
377
414
|
* ```ts
|
|
378
415
|
* ClassicEditor
|
|
379
|
-
* .create(
|
|
416
|
+
* .create( {
|
|
417
|
+
* attachTo: document.querySelector( '#editor' ),
|
|
380
418
|
* menuBar: {
|
|
381
419
|
* addItems: [
|
|
382
420
|
* {
|
|
@@ -393,7 +431,8 @@ export interface EditorConfig extends EngineConfig {
|
|
|
393
431
|
*
|
|
394
432
|
* ```ts
|
|
395
433
|
* ClassicEditor
|
|
396
|
-
* .create(
|
|
434
|
+
* .create( {
|
|
435
|
+
* attachTo: document.querySelector( '#editor' ),
|
|
397
436
|
* menuBar: {
|
|
398
437
|
* addItems: [
|
|
399
438
|
* {
|
|
@@ -427,7 +466,8 @@ export interface EditorConfig extends EngineConfig {
|
|
|
427
466
|
*
|
|
428
467
|
* ```ts
|
|
429
468
|
* ClassicEditor
|
|
430
|
-
* .create(
|
|
469
|
+
* .create( {
|
|
470
|
+
* attachTo: document.querySelector( '#editor' ),
|
|
431
471
|
* menuBar: {
|
|
432
472
|
* items: [
|
|
433
473
|
* {
|
|
@@ -529,6 +569,12 @@ export interface EditorConfig extends EngineConfig {
|
|
|
529
569
|
* element passed to the `create()` method.
|
|
530
570
|
*
|
|
531
571
|
* See the {@glink features/editor-placeholder "Editor placeholder"} guide for more information and live examples.
|
|
572
|
+
*
|
|
573
|
+
* **This property has been deprecated and will be removed in the future versions of CKEditor. Please use
|
|
574
|
+
* {@link module:core/editor/editorconfig~EditorConfig#root `root.placeholder`} or
|
|
575
|
+
* {@link module:core/editor/editorconfig~EditorConfig#roots `roots.<rootName>.placeholder`} instead.**
|
|
576
|
+
*
|
|
577
|
+
* @deprecated
|
|
532
578
|
*/
|
|
533
579
|
placeholder?: string | Record<string, string>;
|
|
534
580
|
/**
|
|
@@ -722,7 +768,8 @@ export interface EditorConfig extends EngineConfig {
|
|
|
722
768
|
*
|
|
723
769
|
* ```ts
|
|
724
770
|
* ClassicEditor
|
|
725
|
-
* .create(
|
|
771
|
+
* .create( {
|
|
772
|
+
* attachTo: document.querySelector( '#editor' ),
|
|
726
773
|
* ui: { ... }
|
|
727
774
|
* } )
|
|
728
775
|
* .then( ... )
|
|
@@ -847,21 +894,249 @@ export interface EditorConfig extends EngineConfig {
|
|
|
847
894
|
* .then( ... )
|
|
848
895
|
* .catch( ... );
|
|
849
896
|
* ```
|
|
897
|
+
*
|
|
898
|
+
* **This property has been deprecated and will be removed in the future versions of CKEditor. Please use
|
|
899
|
+
* {@link module:core/editor/editorconfig~EditorConfig#root `root.label`} or
|
|
900
|
+
* {@link module:core/editor/editorconfig~EditorConfig#roots `roots.<rootName>.label`} instead.**
|
|
901
|
+
*
|
|
902
|
+
* @deprecated
|
|
850
903
|
*/
|
|
851
904
|
label?: string | Record<string, string>;
|
|
905
|
+
/**
|
|
906
|
+
* The root configuration options for the default `main` root.
|
|
907
|
+
*
|
|
908
|
+
* This option is an alias for `config.roots.main`.
|
|
909
|
+
*/
|
|
910
|
+
root?: RootConfig;
|
|
911
|
+
/**
|
|
912
|
+
* The root configuration options grouped by the root name.
|
|
913
|
+
*
|
|
914
|
+
* ```ts
|
|
915
|
+
* ClassicEditor
|
|
916
|
+
* .create( {
|
|
917
|
+
* attachTo: document.querySelector( '#editor' ),
|
|
918
|
+
* roots: {
|
|
919
|
+
* main: {
|
|
920
|
+
* initialData: '<p>Hello world!</p>',
|
|
921
|
+
* placeholder: 'Type some text...',
|
|
922
|
+
* label: 'Main content'
|
|
923
|
+
* }
|
|
924
|
+
* }
|
|
925
|
+
* } );
|
|
926
|
+
* ```
|
|
927
|
+
*/
|
|
928
|
+
roots?: Record<string, RootConfig>;
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Configuration for a an editor root. It is used in {@link module:core/editor/editorconfig~EditorConfig#root `EditorConfig#root`} and
|
|
932
|
+
* {@link module:core/editor/editorconfig~EditorConfig#roots `EditorConfig#roots.<rootName>`}.
|
|
933
|
+
*
|
|
934
|
+
* **Note**: If your editor implementation uses only a single root, you can use `config.root` to set the root configuration instead of
|
|
935
|
+
* `config.roots.main`.
|
|
936
|
+
*/
|
|
937
|
+
export interface RootConfig {
|
|
938
|
+
/**
|
|
939
|
+
* The DOM element that will be the source for the created editor root (on which the editor root will be initialized).
|
|
940
|
+
*
|
|
941
|
+
* If a DOM element is passed, its content will be automatically loaded to the editor upon initialization (but only when
|
|
942
|
+
* {@link #initialData `initialData`} is not set).
|
|
943
|
+
*
|
|
944
|
+
* The editor data will be set back to the original element once the editor is destroyed only if the
|
|
945
|
+
* {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy updateSourceElementOnDestroy}
|
|
946
|
+
* option is set to `true`.
|
|
947
|
+
*
|
|
948
|
+
* If this config property is not set, a detached editor will be created. In this case you need to insert it into the DOM manually.
|
|
949
|
+
*/
|
|
950
|
+
element?: HTMLElement;
|
|
951
|
+
/**
|
|
952
|
+
* The initial editor data to be used instead of the provided element's HTML content.
|
|
953
|
+
*
|
|
954
|
+
* ```ts
|
|
955
|
+
* ClassicEditor
|
|
956
|
+
* .create( {
|
|
957
|
+
* attachTo: document.querySelector( '#editor' ),
|
|
958
|
+
* root: {
|
|
959
|
+
* initialData: '<h2>Initial data</h2><p>Foo bar.</p>'
|
|
960
|
+
* }
|
|
961
|
+
* } )
|
|
962
|
+
* .then( ... )
|
|
963
|
+
* .catch( ... );
|
|
964
|
+
* ```
|
|
965
|
+
*
|
|
966
|
+
* By default, the editor is initialized with the content of the element on which this editor is initialized.
|
|
967
|
+
* This configuration option lets you override this behavior and pass different initial data.
|
|
968
|
+
* It is especially useful if it is difficult for your integration to put the data inside the HTML element.
|
|
969
|
+
*
|
|
970
|
+
* If your editor implementation uses multiple roots, you should provide config for roots individually:
|
|
971
|
+
*
|
|
972
|
+
* ```ts
|
|
973
|
+
* MultiRootEditor.create( {
|
|
974
|
+
* roots: {
|
|
975
|
+
* header: {
|
|
976
|
+
* element: document.querySelector( '#header' ),
|
|
977
|
+
* initialData: '<p>Content for header part.</p>'
|
|
978
|
+
* },
|
|
979
|
+
* content: {
|
|
980
|
+
* element: document.querySelector( '#content' ),
|
|
981
|
+
* initialData: '<p>Content for main part.</p>'
|
|
982
|
+
* },
|
|
983
|
+
* leftSide: {
|
|
984
|
+
* element: document.querySelector( '#left-side' ),
|
|
985
|
+
* initialData: '<p>Content for left-side box.</p>'
|
|
986
|
+
* },
|
|
987
|
+
* rightSide: {
|
|
988
|
+
* element: document.querySelector( '#right-side' ),
|
|
989
|
+
* initialData: '<p>Content for right-side box.</p>'
|
|
990
|
+
* }
|
|
991
|
+
* }
|
|
992
|
+
* } )
|
|
993
|
+
* .then( ... )
|
|
994
|
+
* .catch( ... );
|
|
995
|
+
* ```
|
|
996
|
+
*
|
|
997
|
+
* See also {@link module:core/editor/editor~Editor.create Editor.create()} documentation for the editor implementation which you use.
|
|
998
|
+
*
|
|
999
|
+
* **Note:** If initial data is passed to `Editor.create()` in the first parameter (instead of a DOM element), and,
|
|
1000
|
+
* at the same time, root `initialData` is set, an error will be thrown as those two options exclude themselves.
|
|
1001
|
+
*
|
|
1002
|
+
* If `config.root.initialData` is not set when the editor is initialized, the data received in `Editor.create()` call
|
|
1003
|
+
* will be used to set `config.roots.main.initialData`. As a result, `config.roots.main.initialData` is always set
|
|
1004
|
+
* in the editor's config and plugins can read and/or modify it during initialization.
|
|
1005
|
+
*/
|
|
1006
|
+
initialData?: string;
|
|
1007
|
+
/**
|
|
1008
|
+
* Specifies the text displayed in the editor when there is no content (editor is empty). It is intended to
|
|
1009
|
+
* help users locate the editor in the application (form) and prompt them to input the content. Works similarly
|
|
1010
|
+
* to the native DOM
|
|
1011
|
+
* [`placeholder` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#The_placeholder_attribute)
|
|
1012
|
+
* used by inputs.
|
|
1013
|
+
*
|
|
1014
|
+
* ```ts
|
|
1015
|
+
* ClassicEditor
|
|
1016
|
+
* .create( {
|
|
1017
|
+
* attachTo: document.querySelector( '#editor' ),
|
|
1018
|
+
* root: {
|
|
1019
|
+
* placeholder: 'Type some text...'
|
|
1020
|
+
* }
|
|
1021
|
+
* } )
|
|
1022
|
+
* .then( ... )
|
|
1023
|
+
* .catch( ... );
|
|
1024
|
+
* ```
|
|
1025
|
+
*
|
|
1026
|
+
* If your editor implementation uses multiple roots, you should provide config for roots individually:
|
|
1027
|
+
*
|
|
1028
|
+
* ```ts
|
|
1029
|
+
* MultiRootEditor.create( {
|
|
1030
|
+
* roots: {
|
|
1031
|
+
* header: {
|
|
1032
|
+
* element: document.querySelector( '#header' ),
|
|
1033
|
+
* placeholder: 'Type header...'
|
|
1034
|
+
* },
|
|
1035
|
+
* content: {
|
|
1036
|
+
* element: document.querySelector( '#content' ),
|
|
1037
|
+
* placeholder: 'Type content...'
|
|
1038
|
+
* },
|
|
1039
|
+
* leftSide: {
|
|
1040
|
+
* element: document.querySelector( '#left-side' ),
|
|
1041
|
+
* placeholder: 'Type left-side...'
|
|
1042
|
+
* },
|
|
1043
|
+
* rightSide: {
|
|
1044
|
+
* element: document.querySelector( '#right-side' ),
|
|
1045
|
+
* placeholder: 'Type right-side...'
|
|
1046
|
+
* }
|
|
1047
|
+
* }
|
|
1048
|
+
* } )
|
|
1049
|
+
* .then( ... )
|
|
1050
|
+
* .catch( ... );
|
|
1051
|
+
* ```
|
|
1052
|
+
*
|
|
1053
|
+
* The placeholder text is displayed as a pseudo–element of an empty paragraph in the editor content.
|
|
1054
|
+
* The paragraph has the `.ck-placeholder` CSS class and the `data-placeholder` attribute.
|
|
1055
|
+
*
|
|
1056
|
+
* ```html
|
|
1057
|
+
* <p data-placeholder="Type some text..." class="ck-placeholder">
|
|
1058
|
+
* ::before
|
|
1059
|
+
* </p>
|
|
1060
|
+
* ```
|
|
1061
|
+
*
|
|
1062
|
+
* **Note**: Placeholder text can also be set using the `placeholder` attribute if a `<textarea>` is passed to
|
|
1063
|
+
* the `create()` method, e.g. {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`}.
|
|
1064
|
+
*
|
|
1065
|
+
* **Note**: This configuration has precedence over the value of the `placeholder` attribute of a `<textarea>`
|
|
1066
|
+
* element passed to the `create()` method.
|
|
1067
|
+
*
|
|
1068
|
+
* See the {@glink features/editor-placeholder "Editor placeholder"} guide for more information and live examples.
|
|
1069
|
+
*/
|
|
1070
|
+
placeholder?: string;
|
|
1071
|
+
/**
|
|
1072
|
+
* Label text for the `aria-label` attribute set on editor editing area. Used by assistive technologies
|
|
1073
|
+
* to tell apart multiple editor instances (editing areas) on the page. If not set, a default
|
|
1074
|
+
* "Rich Text Editor. Editing area [name of the area]" is used instead.
|
|
1075
|
+
*
|
|
1076
|
+
* ```ts
|
|
1077
|
+
* ClassicEditor
|
|
1078
|
+
* .create( {
|
|
1079
|
+
* attachTo: document.querySelector( '#editor' ),
|
|
1080
|
+
* root: {
|
|
1081
|
+
* label: 'My editor'
|
|
1082
|
+
* }
|
|
1083
|
+
* } )
|
|
1084
|
+
* .then( ... )
|
|
1085
|
+
* .catch( ... );
|
|
1086
|
+
* ```
|
|
1087
|
+
*
|
|
1088
|
+
* If your editor implementation uses multiple roots, you should provide config for roots individually:
|
|
1089
|
+
*
|
|
1090
|
+
* ```ts
|
|
1091
|
+
* MultiRootEditor.create( {
|
|
1092
|
+
* roots: {
|
|
1093
|
+
* header: {
|
|
1094
|
+
* element: document.querySelector( '#header' ),
|
|
1095
|
+
* label: 'Header label'
|
|
1096
|
+
* },
|
|
1097
|
+
* content: {
|
|
1098
|
+
* element: document.querySelector( '#content' ),
|
|
1099
|
+
* label: 'Content label'
|
|
1100
|
+
* },
|
|
1101
|
+
* leftSide: {
|
|
1102
|
+
* element: document.querySelector( '#left-side' ),
|
|
1103
|
+
* label: 'Left side label'
|
|
1104
|
+
* },
|
|
1105
|
+
* rightSide: {
|
|
1106
|
+
* element: document.querySelector( '#right-side' ),
|
|
1107
|
+
* label: 'Right side label'
|
|
1108
|
+
* }
|
|
1109
|
+
* }
|
|
1110
|
+
* } )
|
|
1111
|
+
* .then( ... )
|
|
1112
|
+
* .catch( ... );
|
|
1113
|
+
* ```
|
|
1114
|
+
*/
|
|
1115
|
+
label?: string;
|
|
852
1116
|
}
|
|
853
1117
|
/**
|
|
854
|
-
* The `config.initialData` option cannot be used together with
|
|
855
|
-
* {@link module:core/editor/editor~Editor.create `Editor.create()`}.
|
|
1118
|
+
* The `config.initialData` option cannot be used together with `config.root.initialData` or
|
|
1119
|
+
* `config.roots.<rootName>.initialData` passed in the {@link module:core/editor/editor~Editor.create `Editor.create()`} configuration.
|
|
856
1120
|
*
|
|
857
1121
|
* @error editor-create-initial-data
|
|
858
1122
|
*/
|
|
1123
|
+
/**
|
|
1124
|
+
* The `config.initialData` option cannot be used together with the `config.root.initialData` or `config.roots.main.initialData`.
|
|
1125
|
+
*
|
|
1126
|
+
* @error editor-create-roots-initial-data
|
|
1127
|
+
*/
|
|
1128
|
+
/**
|
|
1129
|
+
* The `config.attachTo` option is available only for the {@link module:editor-classic/classiceditor~ClassicEditor}.
|
|
1130
|
+
*
|
|
1131
|
+
* @error editor-create-attachto-ignored
|
|
1132
|
+
*/
|
|
859
1133
|
/**
|
|
860
1134
|
* The configuration of the editor language.
|
|
861
1135
|
*
|
|
862
1136
|
* ```ts
|
|
863
1137
|
* ClassicEditor
|
|
864
|
-
* .create(
|
|
1138
|
+
* .create( {
|
|
1139
|
+
* attachTo: document.querySelector( '#editor' ),
|
|
865
1140
|
* language: ... // The editor language configuration.
|
|
866
1141
|
* } )
|
|
867
1142
|
* .then( editor => {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
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
|
+
/**
|
|
6
|
+
* @module core/editor/utils/normalizerootsconfig
|
|
7
|
+
*/
|
|
8
|
+
import type { EditorConfig } from '../editorconfig.js';
|
|
9
|
+
import { type Config } from '@ckeditor/ckeditor5-utils';
|
|
10
|
+
/**
|
|
11
|
+
* Normalizes the editor roots configuration. It ensures that all root configurations are defined in `config.roots`
|
|
12
|
+
* and that they have `initialData` defined.
|
|
13
|
+
*
|
|
14
|
+
* It normalizes a single-root configuration (where `config.root` is used) to a multi-root configuration
|
|
15
|
+
* (where all roots are defined in `config.roots`). This is considered a standard configuration format,
|
|
16
|
+
* so the editor features can always expect roots to be defined in `config.roots`.
|
|
17
|
+
*
|
|
18
|
+
* It also handles legacy configuration options, such as `config.initialData`, `config.placeholder`, and `config.label`.
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare function normalizeRootsConfig(sourceElementsOrData: HTMLElement | string | Record<string, HTMLElement> | Record<string, string>, config: Config<EditorConfig>, defaultRootName?: string | false, separateAttachTo?: boolean): void;
|
|
23
|
+
/**
|
|
24
|
+
* Normalizes the parameters passed to the editor constructor when a single root is used. It supports both of the following signatures:
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* new Editor( editorConfig: EditorConfig );
|
|
28
|
+
* new Editor( sourceElementOrData: HTMLElement | string, editorConfig: EditorConfig );
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export declare function normalizeSingleRootEditorConstructorParams(sourceElementOrDataOrConfig: HTMLElement | string | EditorConfig, editorConfig: EditorConfig): {
|
|
34
|
+
sourceElementOrData: HTMLElement | string;
|
|
35
|
+
editorConfig: EditorConfig;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Normalizes the parameters passed to the editor constructor when a multi root is used. It supports both of the following signatures:
|
|
39
|
+
*
|
|
40
|
+
* ```ts
|
|
41
|
+
* new Editor( editorConfig: EditorConfig );
|
|
42
|
+
* new Editor( sourceElementsOrData: Record<string, string> | Record<string, HTMLElement>, editorConfig: EditorConfig );
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export declare function normalizeMultiRootEditorConstructorParams(sourceElementOrDataOrConfig: Record<string, string> | Record<string, HTMLElement>, editorConfig: EditorConfig): {
|
|
48
|
+
sourceElementsOrData: Record<string, string> | Record<string, HTMLElement>;
|
|
49
|
+
editorConfig: EditorConfig;
|
|
50
|
+
};
|
package/dist/index-content.css
CHANGED
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
:root{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
--ck-content-font-family:Helvetica, Arial, Tahoma, Verdana, Sans-Serif;
|
|
7
|
+
--ck-content-font-size:medium;
|
|
8
|
+
--ck-content-font-color:#000;
|
|
9
|
+
--ck-content-line-height:1.5;
|
|
10
|
+
--ck-content-word-break:break-word;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
.ck-content{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
font-family:var(--ck-content-font-family);
|
|
15
|
+
font-size:var(--ck-content-font-size);
|
|
16
|
+
color:var(--ck-content-font-color);
|
|
17
|
+
line-height:var(--ck-content-line-height);
|
|
18
|
+
word-break:var(--ck-content-word-break);
|
|
19
19
|
}
|
package/dist/index-editor.css
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
:root{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
--ck-content-font-family:Helvetica, Arial, Tahoma, Verdana, Sans-Serif;
|
|
7
|
+
--ck-content-font-size:medium;
|
|
8
|
+
--ck-content-font-color:#000;
|
|
9
|
+
--ck-content-line-height:1.5;
|
|
10
|
+
--ck-content-word-break:break-word;
|
|
11
11
|
}
|
package/dist/index.css
CHANGED
|
@@ -2,26 +2,20 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
5
|
:root {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
--ck-content-word-break: break-word;
|
|
6
|
+
--ck-content-font-family: Helvetica, Arial, Tahoma, Verdana, Sans-Serif;
|
|
7
|
+
--ck-content-font-size: medium;
|
|
8
|
+
--ck-content-font-color: #000;
|
|
9
|
+
--ck-content-line-height: 1.5;
|
|
10
|
+
--ck-content-word-break: break-word;
|
|
17
11
|
}
|
|
18
12
|
|
|
19
13
|
.ck-content {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
font-family: var(--ck-content-font-family);
|
|
15
|
+
font-size: var(--ck-content-font-size);
|
|
16
|
+
color: var(--ck-content-font-color);
|
|
17
|
+
line-height: var(--ck-content-line-height);
|
|
18
|
+
word-break: var(--ck-content-word-break);
|
|
25
19
|
}
|
|
26
20
|
|
|
27
21
|
/*# sourceMappingURL=index.css.map */
|
package/dist/index.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../theme/core.css","index.css"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"sources":["../theme/core.css","index.css"],"names":[],"mappings":";;;;AAKA,CAAA,IAAA,CAAA;ACJA,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK;AACzE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM;AAChC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG;AAC/B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI;AACrC;;ADQA,CAAA,EAAA,CAAA,OAAA,CAAA;ACLA,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;AAC5C,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;AACxC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;AACrC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;AAC5C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;AAC1C;;AAEA,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC","file":"index.css.map","sourcesContent":["/*\n * Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n\n:root {\n\t--ck-content-font-family: Helvetica, Arial, Tahoma, Verdana, Sans-Serif;\n\t--ck-content-font-size: medium;\n\t/* stylelint-disable-next-line declaration-property-value-disallowed-list */\n\t--ck-content-font-color: #000;\n\t--ck-content-line-height: 1.5;\n\t--ck-content-word-break: break-word;\n}\n\n.ck-content {\n\tfont-family: var(--ck-content-font-family);\n\tfont-size: var(--ck-content-font-size);\n\tcolor: var(--ck-content-font-color);\n\tline-height: var(--ck-content-line-height);\n\tword-break: var(--ck-content-word-break);\n}\n",":root {\n --ck-content-font-family: Helvetica, Arial, Tahoma, Verdana, Sans-Serif;\n --ck-content-font-size: medium;\n --ck-content-font-color: #000;\n --ck-content-line-height: 1.5;\n --ck-content-word-break: break-word;\n}\n\n.ck-content {\n font-family: var(--ck-content-font-family);\n font-size: var(--ck-content-font-size);\n color: var(--ck-content-font-color);\n line-height: var(--ck-content-line-height);\n word-break: var(--ck-content-word-break);\n}\n\n/*# sourceMappingURL=index.css.map */"]}
|
package/{src → dist}/index.d.ts
RENAMED
|
@@ -15,10 +15,11 @@ export { ContextPlugin, type ContextInterface, type ContextPluginDependencies }
|
|
|
15
15
|
export { EditingKeystrokeHandler, type EditingKeystrokeCallback } from './editingkeystrokehandler.js';
|
|
16
16
|
export type { PartialBy, NonEmptyArray, HexColor } from './typings.js';
|
|
17
17
|
export { Editor, type EditorCollectUsageDataEvent, type EditorReadyEvent, type EditorDestroyEvent, type LicenseErrorReason as _LicenseErrorReason } from './editor/editor.js';
|
|
18
|
-
export type { EditorConfig, LanguageConfig, ToolbarConfig, ToolbarConfigItem, UiConfig, ViewportOffsetConfig, PoweredByConfig } from './editor/editorconfig.js';
|
|
18
|
+
export type { EditorConfig, RootConfig, LanguageConfig, ToolbarConfig, ToolbarConfigItem, UiConfig, ViewportOffsetConfig, PoweredByConfig } from './editor/editorconfig.js';
|
|
19
19
|
export { attachToForm } from './editor/utils/attachtoform.js';
|
|
20
20
|
export { ElementApiMixin, type ElementApi } from './editor/utils/elementapimixin.js';
|
|
21
21
|
export { secureSourceElement } from './editor/utils/securesourceelement.js';
|
|
22
|
+
export { normalizeRootsConfig, normalizeSingleRootEditorConstructorParams, normalizeMultiRootEditorConstructorParams } from './editor/utils/normalizerootsconfig.js';
|
|
22
23
|
export { PendingActions, type PendingAction, type PendingActionsAddEvent, type PendingActionsRemoveEvent } from './pendingactions.js';
|
|
23
24
|
export { Accessibility, DEFAULT_GROUP_ID as _DEFAULT_ACCESSIBILITY_GROUP_ID, type AddKeystrokeInfoCategoryData, type AddKeystrokeInfoGroupData, type AddKeystrokeInfosData, type KeystrokeInfoDefinition, type KeystrokeInfoDefinitions, type KeystrokeInfoGroupDefinition, type KeystrokeInfoCategoryDefinition } from './accessibility.js';
|
|
24
25
|
export { getEditorUsageData as _getEditorUsageData, type EditorUsageData as _EditorUsageData } from './editor/utils/editorusagedata.js';
|