@ckeditor/ckeditor5-core 40.0.0 → 40.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/CHANGELOG.md +28 -28
  2. package/LICENSE.md +3 -3
  3. package/README.md +1 -1
  4. package/lang/contexts.json +5 -1
  5. package/lang/translations/af.po +16 -0
  6. package/lang/translations/ar.po +16 -0
  7. package/lang/translations/ast.po +16 -0
  8. package/lang/translations/az.po +16 -0
  9. package/lang/translations/bg.po +16 -0
  10. package/lang/translations/bn.po +16 -0
  11. package/lang/translations/bs.po +16 -0
  12. package/lang/translations/ca.po +16 -0
  13. package/lang/translations/cs.po +16 -0
  14. package/lang/translations/da.po +16 -0
  15. package/lang/translations/de-ch.po +16 -0
  16. package/lang/translations/de.po +16 -0
  17. package/lang/translations/el.po +16 -0
  18. package/lang/translations/en-au.po +16 -0
  19. package/lang/translations/en-gb.po +16 -0
  20. package/lang/translations/en.po +16 -0
  21. package/lang/translations/eo.po +16 -0
  22. package/lang/translations/es-co.po +16 -0
  23. package/lang/translations/es.po +16 -0
  24. package/lang/translations/et.po +16 -0
  25. package/lang/translations/eu.po +16 -0
  26. package/lang/translations/fa.po +16 -0
  27. package/lang/translations/fi.po +16 -0
  28. package/lang/translations/fr.po +16 -0
  29. package/lang/translations/gl.po +16 -0
  30. package/lang/translations/gu.po +16 -0
  31. package/lang/translations/he.po +16 -0
  32. package/lang/translations/hi.po +16 -0
  33. package/lang/translations/hr.po +16 -0
  34. package/lang/translations/hu.po +16 -0
  35. package/lang/translations/hy.po +16 -0
  36. package/lang/translations/id.po +16 -0
  37. package/lang/translations/it.po +16 -0
  38. package/lang/translations/ja.po +16 -0
  39. package/lang/translations/jv.po +16 -0
  40. package/lang/translations/km.po +16 -0
  41. package/lang/translations/kn.po +16 -0
  42. package/lang/translations/ko.po +16 -0
  43. package/lang/translations/ku.po +16 -0
  44. package/lang/translations/lt.po +16 -0
  45. package/lang/translations/lv.po +16 -0
  46. package/lang/translations/ms.po +16 -0
  47. package/lang/translations/nb.po +16 -0
  48. package/lang/translations/ne.po +16 -0
  49. package/lang/translations/nl.po +16 -0
  50. package/lang/translations/no.po +16 -0
  51. package/lang/translations/oc.po +16 -0
  52. package/lang/translations/pl.po +16 -0
  53. package/lang/translations/pt-br.po +16 -0
  54. package/lang/translations/pt.po +16 -0
  55. package/lang/translations/ro.po +16 -0
  56. package/lang/translations/ru.po +16 -0
  57. package/lang/translations/si.po +16 -0
  58. package/lang/translations/sk.po +16 -0
  59. package/lang/translations/sl.po +16 -0
  60. package/lang/translations/sq.po +16 -0
  61. package/lang/translations/sr-latn.po +17 -1
  62. package/lang/translations/sr.po +16 -0
  63. package/lang/translations/sv.po +16 -0
  64. package/lang/translations/th.po +16 -0
  65. package/lang/translations/tk.po +16 -0
  66. package/lang/translations/tr.po +16 -0
  67. package/lang/translations/tt.po +16 -0
  68. package/lang/translations/ug.po +17 -1
  69. package/lang/translations/uk.po +16 -0
  70. package/lang/translations/ur.po +16 -0
  71. package/lang/translations/uz.po +16 -0
  72. package/lang/translations/vi.po +16 -0
  73. package/lang/translations/zh-cn.po +16 -0
  74. package/lang/translations/zh.po +16 -0
  75. package/package.json +3 -3
  76. package/src/augmentation.d.ts +10 -10
  77. package/src/augmentation.js +5 -5
  78. package/src/command.d.ts +189 -189
  79. package/src/command.js +185 -185
  80. package/src/commandcollection.d.ts +83 -83
  81. package/src/commandcollection.js +83 -83
  82. package/src/context.d.ts +237 -237
  83. package/src/context.js +225 -225
  84. package/src/contextplugin.d.ts +61 -61
  85. package/src/contextplugin.js +43 -43
  86. package/src/editingkeystrokehandler.d.ts +56 -56
  87. package/src/editingkeystrokehandler.js +57 -57
  88. package/src/editor/editor.d.ts +417 -417
  89. package/src/editor/editor.js +316 -316
  90. package/src/editor/editorconfig.d.ts +661 -660
  91. package/src/editor/editorconfig.js +5 -5
  92. package/src/editor/utils/attachtoform.d.ts +15 -15
  93. package/src/editor/utils/attachtoform.js +57 -57
  94. package/src/editor/utils/dataapimixin.d.ts +75 -75
  95. package/src/editor/utils/dataapimixin.js +24 -24
  96. package/src/editor/utils/elementapimixin.d.ts +35 -31
  97. package/src/editor/utils/elementapimixin.js +43 -42
  98. package/src/editor/utils/securesourceelement.d.ts +17 -17
  99. package/src/editor/utils/securesourceelement.js +35 -35
  100. package/src/index.d.ts +66 -62
  101. package/src/index.js +103 -95
  102. package/src/multicommand.d.ts +66 -66
  103. package/src/multicommand.js +82 -82
  104. package/src/pendingactions.d.ts +117 -117
  105. package/src/pendingactions.js +116 -116
  106. package/src/plugin.d.ts +274 -274
  107. package/src/plugin.js +106 -106
  108. package/src/plugincollection.d.ts +117 -117
  109. package/src/plugincollection.js +473 -473
  110. package/theme/icons/image-asset-manager.svg +1 -0
  111. package/theme/icons/image-upload.svg +1 -0
  112. package/theme/icons/image-url.svg +1 -0
  113. package/theme/icons/image.svg +1 -1
  114. package/theme/icons/low-vision.svg +1 -1
  115. package/theme/icons/text-alternative.svg +1 -0
@@ -1,660 +1,661 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, 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
- /**
6
- * @module core/editor/editorconfig
7
- */
8
- import type Context from '../context';
9
- import type { PluginConstructor } from '../plugin';
10
- import type Editor from './editor';
11
- /**
12
- * CKEditor configuration options.
13
- *
14
- * An object defining the editor configuration can be passed when initializing the editor:
15
- *
16
- * ```ts
17
- * EditorClass
18
- * .create( {
19
- * toolbar: [ 'bold', 'italic' ],
20
- * image: {
21
- * styles: [
22
- * ...
23
- * ]
24
- * }
25
- * } )
26
- * .then( ... )
27
- * .catch( ... );
28
- * ```
29
- *
30
- * Check the {@glink installation/getting-started/predefined-builds Configuration} guide for more information
31
- * about setting configuration options.
32
- */
33
- export interface EditorConfig {
34
- context?: Context;
35
- /**
36
- * The list of additional plugins to load along those already available in the
37
- * {@glink installation/getting-started/predefined-builds editor build}. It extends the {@link #plugins `plugins`} configuration.
38
- *
39
- * ```ts
40
- * function MyPlugin( editor ) {
41
- * // ...
42
- * }
43
- *
44
- * const config = {
45
- * extraPlugins: [ MyPlugin ]
46
- * };
47
- * ```
48
- *
49
- * **Note:** This configuration works only for simple plugins which utilize the
50
- * {@link module:core/plugin~PluginInterface plugin interface} and have no dependencies. To extend a
51
- * build with complex features, create a
52
- * {@glink installation/getting-started/quick-start-other#creating-custom-builds-with-online-builder custom build}.
53
- *
54
- * **Note:** Make sure you include the new features in you toolbar configuration. Learn more
55
- * about the {@glink features/toolbar/toolbar toolbar setup}.
56
- */
57
- extraPlugins?: Array<PluginConstructor<Editor>>;
58
- /**
59
- * The initial editor data to be used instead of the provided element's HTML content.
60
- *
61
- * ```ts
62
- * ClassicEditor
63
- * .create( document.querySelector( '#editor' ), {
64
- * initialData: '<h2>Initial data</h2><p>Foo bar.</p>'
65
- * } )
66
- * .then( ... )
67
- * .catch( ... );
68
- * ```
69
- *
70
- * By default, the editor is initialized with the content of the element on which this editor is initialized.
71
- * This configuration option lets you override this behavior and pass different initial data.
72
- * It is especially useful if it is difficult for your integration to put the data inside the HTML element.
73
- *
74
- * If your editor implementation uses multiple roots, you should pass an object with keys corresponding to the editor
75
- * roots names and values equal to the data that should be set in each root:
76
- *
77
- * ```ts
78
- * MultiRootEditor.create(
79
- * // Roots for the editor:
80
- * {
81
- * header: document.querySelector( '#header' ),
82
- * content: document.querySelector( '#content' ),
83
- * leftSide: document.querySelector( '#left-side' ),
84
- * rightSide: document.querySelector( '#right-side' )
85
- * },
86
- * // Config:
87
- * {
88
- * initialData: {
89
- * header: '<p>Content for header part.</p>',
90
- * content: '<p>Content for main part.</p>',
91
- * leftSide: '<p>Content for left-side box.</p>',
92
- * rightSide: '<p>Content for right-side box.</p>'
93
- * }
94
- * }
95
- * )
96
- * .then( ... )
97
- * .catch( ... );
98
- * ```
99
- *
100
- * See also {@link module:core/editor/editor~Editor.create Editor.create()} documentation for the editor implementation which you use.
101
- *
102
- * **Note:** If initial data is passed to `Editor.create()` in the first parameter (instead of a DOM element), and,
103
- * at the same time, `config.initialData` is set, an error will be thrown as those two options exclude themselves.
104
- *
105
- * If `config.initialData` is not set when the editor is initialized, the data received in `Editor.create()` call
106
- * will be used to set `config.initialData`. As a result, `initialData` is always set in the editor's config and
107
- * plugins can read and/or modify it during initialization.
108
- */
109
- initialData?: string | Record<string, string>;
110
- /**
111
- * The language of the editor UI and its content.
112
- *
113
- * Note: You do not have to specify this option if your build is optimized for one UI language or if it is
114
- * the default language (English is the default language for CDN builds), unless you want to change
115
- * the language of your content.
116
- *
117
- * Simple usage (change the language of the UI and the content):
118
- *
119
- * ```ts
120
- * ClassicEditor
121
- * .create( document.querySelector( '#editor' ), {
122
- * // The UI of the editor as well as its content will be in German.
123
- * language: 'de'
124
- * } )
125
- * .then( editor => {
126
- * console.log( editor );
127
- * } )
128
- * .catch( error => {
129
- * console.error( error );
130
- * } );
131
- * ```
132
- *
133
- * Use different languages for the UI and the content using the {@link module:core/editor/editorconfig~LanguageConfig configuration}
134
- * syntax:
135
- *
136
- * ```ts
137
- * ClassicEditor
138
- * .create( document.querySelector( '#editor' ), {
139
- * language: {
140
- * // The UI will be in English.
141
- * ui: 'en',
142
- *
143
- * // But the content will be edited in Arabic.
144
- * content: 'ar'
145
- * }
146
- * } )
147
- * .then( editor => {
148
- * console.log( editor );
149
- * } )
150
- * .catch( error => {
151
- * console.error( error );
152
- * } );
153
- * ```
154
- *
155
- * The language of the content has an impact on the editing experience, for instance it affects screen readers
156
- * and spell checkers. It is also particularly useful for typing in certain languages (e.g. right–to–left ones)
157
- * because it changes the default alignment of the text.
158
- *
159
- * The language codes are defined in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) standard.
160
- *
161
- * You need to add the corresponding translation file for the new UI language to work.
162
- * Translation files are available on CDN for predefined builds:
163
- *
164
- * ```html
165
- * `<script src="https://cdn.ckeditor.com/ckeditor5/[version.number]/[distribution]/lang/[lang].js"></script>`
166
- * ```
167
- *
168
- * But you can add them manually by coping from the `node_modules/@ckeditor/ckeditor5-build-[name]/build/lang/[lang].js'`.
169
- *
170
- * Check the {@glink features/ui-language UI language} guide for more information about the localization options and translation
171
- * process.
172
- */
173
- language?: string | LanguageConfig;
174
- /**
175
- * Specifies the text displayed in the editor when there is no content (editor is empty). It is intended to
176
- * help users locate the editor in the application (form) and prompt them to input the content. Work similarly
177
- * as to the native DOM
178
- * [`placeholder` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#The_placeholder_attribute)
179
- * used by inputs.
180
- *
181
- * ```ts
182
- * ClassicEditor
183
- * .create( document.querySelector( '#editor' ), {
184
- * placeholder: 'Type some text...'
185
- * } )
186
- * .then( ... )
187
- * .catch( ... );
188
- * ```
189
- *
190
- * If your editor implementation uses multiple roots, you should pass an object with keys corresponding to the editor
191
- * roots names and values equal to the placeholder that should be set in each root:
192
- *
193
- * ```ts
194
- * MultiRootEditor.create(
195
- * // Roots for the editor:
196
- * {
197
- * header: document.querySelector( '#header' ),
198
- * content: document.querySelector( '#content' ),
199
- * leftSide: document.querySelector( '#left-side' ),
200
- * rightSide: document.querySelector( '#right-side' )
201
- * },
202
- * // Config:
203
- * {
204
- * placeholder: {
205
- * header: 'Type header...',
206
- * content: 'Type content...',
207
- * leftSide: 'Type left-side...',
208
- * rightSide: 'Type right-side...'
209
- * }
210
- * }
211
- * )
212
- * .then( ... )
213
- * .catch( ... );
214
- * ```
215
- *
216
- * The placeholder text is displayed as a pseudo–element of an empty paragraph in the editor content.
217
- * The paragraph has the `.ck-placeholder` CSS class and the `data-placeholder` attribute.
218
- *
219
- * ```html
220
- * <p data-placeholder="Type some text..." class="ck-placeholder">
221
- * ::before
222
- * </p>
223
- * ```
224
- *
225
- * **Note**: Placeholder text can also be set using the `placeholder` attribute if a `<textarea>` is passed to
226
- * the `create()` method, e.g. {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`}.
227
- *
228
- * **Note**: This configuration has precedence over the value of the `placeholder` attribute of a `<textarea>`
229
- * element passed to the `create()` method.
230
- *
231
- * See the {@glink features/editor-placeholder "Editor placeholder"} guide for more information and live examples.
232
- */
233
- placeholder?: string | Record<string, string>;
234
- /**
235
- * The list of plugins to load.
236
- *
237
- * If you use an {@glink installation/getting-started/predefined-builds editor build} you can define the list of plugins to load
238
- * using the names of plugins that are available:
239
- *
240
- * ```ts
241
- * const config = {
242
- * plugins: [ 'Bold', 'Italic', 'Typing', 'Enter', ... ]
243
- * };
244
- * ```
245
- *
246
- * You can check the list of plugins available in a build using this snippet:
247
- *
248
- * ```ts
249
- * ClassicEditor.builtinPlugins.map( plugin => plugin.pluginName );
250
- * ```
251
- *
252
- * If you use an editor creator directly (imported from a package like `@ckeditor/ckeditor5-editor-classic`) or you
253
- * want to load additional plugins which were not included in a build you use, then you need to specify
254
- * the plugins using their constructors:
255
- *
256
- * ```ts
257
- * // A preset of plugins is a plugin as well.
258
- * import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
259
- * // The bold plugin.
260
- * import Bold from '@ckeditor/ckeditor5-editor-basic-styles/src/bold';
261
- *
262
- * const config = {
263
- * plugins: [ Essentials, Bold ]
264
- * };
265
- * ```
266
- *
267
- * **Note:** To load additional plugins, you should use the {@link #extraPlugins `extraPlugins`} configuration.
268
- * To narrow the list of loaded plugins, use the {@link #removePlugins `removePlugins`} configuration.
269
- */
270
- plugins?: Array<PluginConstructor<Editor> | string>;
271
- /**
272
- * The list of plugins which should not be loaded despite being available in an {@glink installation/getting-started/predefined-builds
273
- * editor build}.
274
- *
275
- * ```ts
276
- * const config = {
277
- * removePlugins: [ 'Bold', 'Italic' ]
278
- * };
279
- * ```
280
- *
281
- * **Note:** Be careful when removing plugins using `config.removePlugins` from CKEditor builds.
282
- * If removed plugins were providing toolbar buttons, the default toolbar configuration included in a build
283
- * will become invalid. In such case you need to provide the updated
284
- * {@link module:core/editor/editorconfig~EditorConfig#toolbar toolbar configuration}.
285
- */
286
- removePlugins?: Array<PluginConstructor<Editor> | string>;
287
- substitutePlugins?: Array<PluginConstructor<Editor>>;
288
- /**
289
- * The editor toolbar configuration.
290
- *
291
- * Simple format (specifies only toolbar items):
292
- *
293
- * ```ts
294
- * const config = {
295
- * toolbar: [ 'bold', 'italic', '|', 'undo', 'redo' ]
296
- * };
297
- * ```
298
- *
299
- * Extended format:
300
- *
301
- * ```ts
302
- * const config = {
303
- * toolbar: {
304
- * items: [ 'bold', 'italic', '|', 'undo', 'redo', '-', 'numberedList', 'bulletedList' ],
305
- *
306
- * shouldNotGroupWhenFull: true
307
- * }
308
- * };
309
- * ```
310
- *
311
- * Options which can be set using the extended format:
312
- *
313
- * * **`toolbar.items`** &ndash; An array of toolbar item names. The components (buttons, dropdowns, etc.) which can be used
314
- * as toolbar items are defined in `editor.ui.componentFactory` and can be listed using the following snippet:
315
- *
316
- * ```ts
317
- * Array.from( editor.ui.componentFactory.names() );
318
- * ```
319
- *
320
- * You can also use `'|'` to create a separator between groups of items:
321
- *
322
- * ```
323
- * toolbar: [ 'bold', 'italic', '|', 'undo', 'redo' ]
324
- * ```
325
- *
326
- * or `'-'` to make a line break and render items in multiple lines:
327
- *
328
- * ```
329
- * toolbar: [ 'bold', 'italic', '-', 'undo', 'redo' ]
330
- * ```
331
- *
332
- * Line break will work only in the extended format when `shouldNotGroupWhenFull` option is set to `true`.
333
- *
334
- * **Note**: To save space in your toolbar, you can group several items into a dropdown:
335
- *
336
- * ```
337
- * toolbar: [
338
- * {
339
- * label: 'Basic styles',
340
- * icon: 'text',
341
- * items: [ 'bold', 'italic', ... ]
342
- * },
343
- * '|',
344
- * 'undo', 'redo'
345
- * ]
346
- * ```
347
- *
348
- * The code above will create a "Basic styles" dropdown with a "text" icon containing the "bold" and "italic" buttons.
349
- * You can customize the look of the dropdown by setting the `withText`, `icon`, and `tooltip` properties:
350
- *
351
- * * **Displaying a label**
352
- *
353
- * For instance, to hide the icon and to display the label only, you can use the following configuration:
354
- *
355
- * ```ts
356
- * {
357
- * label: 'Basic styles',
358
- * // Show the textual label of the drop-down. Note that the "icon" property is not configured.
359
- * withText: true,
360
- * items: [ 'bold', 'italic', ... ]
361
- * }
362
- * ```
363
- *
364
- * * **Selecting an icon**
365
- *
366
- * You can use one of the common icons provided by the editor (`'bold'`, `'plus'`, `'text'`, `'importExport'`, `'alignLeft'`,
367
- * `'paragraph'`, `'threeVerticalDots'`, `'dragIndicator'`, `'pilcrow'`):
368
- *
369
- * ```ts
370
- * {
371
- * label: '...',
372
- * // A "plus" sign icon works best for content insertion tools.
373
- * icon: 'plus',
374
- * items: [ ... ]
375
- * }
376
- * ```
377
- *
378
- * If no icon is specified, `'threeVerticalDots'` will be used as a default:
379
- *
380
- * ```ts
381
- * // No icon specified, using a default one.
382
- * {
383
- * label: 'Default icon',
384
- * items: [ ... ]
385
- * }
386
- * ```
387
- *
388
- * If `icon: false` is configured, no icon will be displayed at all and the text label will show up instead:
389
- *
390
- * ```ts
391
- * // This drop-down has no icon. The text label will be displayed instead.
392
- * {
393
- * label: 'No icon',
394
- * icon: false,
395
- * items: [ ... ]
396
- * }
397
- * ```
398
- *
399
- * You can also set a custom icon for the drop-down by passing an SVG string:
400
- *
401
- * ```ts
402
- * {
403
- * label: '...',
404
- * // If you want your icon to change the color dynamically (e.g. when the dropdown opens), avoid fill="..."
405
- * // and stroke="..." styling attributes. Use solid shapes and avoid paths with strokes.
406
- * icon: '<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">...</svg>',
407
- * items: [ ... ]
408
- * }
409
- * ```
410
- *
411
- * * **Customizing the tooltip**
412
- *
413
- * By default, the tooltip of the button shares its text with the label. You can customize it to better describe your dropdown
414
- * using the `tooltip` property ({@link module:ui/button/buttonview~ButtonView#tooltip learn more}):
415
- *
416
- * ```ts
417
- * {
418
- * label: 'Drop-down label',
419
- * tooltip: 'Custom tooltip of the drop-down',
420
- * icon: '...',
421
- * items: [ ... ]
422
- * }
423
- * ```
424
- *
425
- * * **`toolbar.viewportTopOffset` (deprecated)** &ndash; The offset (in pixels) from the top of the viewport used when positioning a
426
- * sticky toolbar.
427
- * Useful when a page with which the editor is being integrated has some other sticky or fixed elements
428
- * (e.g. the top menu). Thanks to setting the toolbar offset the toolbar will not be positioned underneath or above the page's UI.
429
- *
430
- * **This property has been deprecated and will be removed in the future versions of CKEditor. Please use
431
- * `{@link module:core/editor/editorconfig~EditorConfig#ui EditorConfig#ui.viewportOffset}` instead.**
432
- *
433
- * * **`toolbar.shouldNotGroupWhenFull`** &ndash; When set to `true`, the toolbar will stop grouping items
434
- * and let them wrap to the next line if there is not enough space to display them in a single row.
435
- */
436
- toolbar?: ToolbarConfig;
437
- /**
438
- * The editor UI configuration.
439
- *
440
- * ```ts
441
- * ClassicEditor
442
- * .create( document.querySelector( '#editor' ), {
443
- * ui: { ... }
444
- * } )
445
- * .then( ... )
446
- * .catch( ... );
447
- * ```
448
- *
449
- * Options which can be set using the UI configuration:
450
- *
451
- * * **`ui.viewportOffset`** &ndash; The offset (in pixels) of the viewport from every direction. It is
452
- * used when positioning a sticky toolbar or other absolutely positioned UI elements.
453
- * Useful when a page with which the editor is being integrated has some other sticky or fixed elements
454
- * (e.g. the top menu). Thanks to setting the UI viewport offset, the toolbar and other contextual balloons will not be positioned
455
- * underneath or above the page's UI.
456
- *
457
- * ```ts
458
- * ui: {
459
- * viewportOffset: { top: 10, right: 10, bottom: 10, left: 10 }
460
- * }
461
- * ```
462
- *
463
- * **Note:** If you want to modify the viewport offset in runtime (after the editor was created), you can do that by overriding
464
- * {@link module:ui/editorui/editorui~EditorUI#viewportOffset `editor.ui.viewportOffset`}.
465
- *
466
- * * **`ui.poweredBy`** &ndash; The configuration of the project logo displayed over the editor's editing area in
467
- * open-source integrations. It allows customizing the position of the logo to minimize the risk of collision with the
468
- * editor content and UI.
469
- *
470
- * The following configuration properties are supported:
471
- *
472
- * * **`position`** &ndash; The position of the project's logo (default: `'border'`).
473
- * * When `'inside'`, the logo will be displayed within the boundaries of the editing area.
474
- * * When `'border'`, the logo will be displayed over the bottom border of the editing area.
475
- *
476
- * * **`side`** (`'left'` or `'right'`, default: `'right'`) &ndash; The side of the editing area where the
477
- * logo will be displayed.
478
- *
479
- * **Note**: If {@link module:core/editor/editorconfig~EditorConfig#language `config.language`} is set to an RTL (right-to-left)
480
- * language, the side switches to `'left'` by default.
481
- *
482
- * * **`label`** (default: `'Powered by'`) &ndash; The label displayed next to the project's logo.
483
- *
484
- * **Note**: Set the value to `null` to display the logo without any text.
485
- *
486
- * * **`verticalOffset`** (default: `5`) &ndash; The vertical distance the logo can be moved away from its default position.
487
- *
488
- * **Note**: If `position` is `'border'`, the offset is measured from the (vertical) center of the logo.
489
- *
490
- * * **`horizontalOffset`** (default: `5`) &ndash; The horizontal distance between the side of the editing root and the
491
- * nearest side of the logo.
492
- *
493
- * ```ts
494
- * ui: {
495
- * poweredBy: {
496
- * position: 'border',
497
- * side: 'left',
498
- * verticalOffset: 2,
499
- * horizontalOffset: 30
500
- * }
501
- * }
502
- */
503
- ui?: UiConfig;
504
- /**
505
- * Enables updating the source element after the editor is destroyed.
506
- *
507
- * Enabling this option might have some security implications, as the editor doesn't have control over all data
508
- * in the output.
509
- *
510
- * Be careful, especially while using the
511
- * {@glink features/markdown Markdown}, {@glink features/html/general-html-support General HTML Support}, or
512
- * {@glink features/html/html-embed HTML embed} features.
513
- */
514
- updateSourceElementOnDestroy?: boolean;
515
- /**
516
- * The license key for the CKEditor 5 commercial license and the premium features.
517
- *
518
- * If you do not have a key yet, please [contact us](https://ckeditor.com/contact/) or
519
- * [order a trial](https://orders.ckeditor.com/trial/premium-features).
520
- */
521
- licenseKey?: string;
522
- }
523
- /**
524
- * The `config.initialData` option cannot be used together with the initial data passed as the first parameter of
525
- * {@link module:core/editor/editor~Editor.create `Editor.create()`}.
526
- *
527
- * @error editor-create-initial-data
528
- */
529
- /**
530
- * The configuration of the editor language.
531
- *
532
- * ```ts
533
- * ClassicEditor
534
- * .create( document.querySelector( '#editor' ), {
535
- * language: ... // The editor language configuration.
536
- * } )
537
- * .then( editor => {
538
- * console.log( editor );
539
- * } )
540
- * .catch( error => {
541
- * console.error( error );
542
- * } );
543
- * ```
544
- *
545
- * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
546
- */
547
- export interface LanguageConfig {
548
- /**
549
- * Allows to use a different language for the editor UI.
550
- *
551
- * The language codes are defined in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) standard.
552
- */
553
- ui?: string;
554
- /**
555
- * Allows to use a different language of the editor content.
556
- *
557
- * The language codes are defined in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) standard.
558
- */
559
- content?: string;
560
- }
561
- export type ToolbarConfig = Array<ToolbarConfigItem> | {
562
- items?: Array<ToolbarConfigItem>;
563
- removeItems?: Array<string>;
564
- shouldNotGroupWhenFull?: boolean;
565
- };
566
- export type ToolbarConfigItem = string | {
567
- items: Array<ToolbarConfigItem>;
568
- label: string;
569
- icon?: string | false;
570
- withText?: boolean;
571
- tooltip?: boolean | string | ((label: string, keystroke: string | undefined) => string);
572
- };
573
- /**
574
- * The “Powered by CKEditor” logo configuration options.
575
- **/
576
- export interface PoweredByConfig {
577
- /**
578
- * The position of the project's logo.
579
- *
580
- * * When `'inside'`, the logo will be displayed within the boundaries of the editing area.
581
- * * When `'border'`, the logo will be displayed over the bottom border of the editing area.
582
- *
583
- * @default 'border'
584
- */
585
- position: 'inside' | 'border';
586
- /**
587
- * Allows choosing the side of the editing area where the logo will be displayed.
588
- *
589
- * **Note:** If {@link module:core/editor/editorconfig~EditorConfig#language `config.language`} is set to an RTL (right-to-left)
590
- * language, the side switches to `'left'` by default.
591
- *
592
- * @default 'right'
593
- */
594
- side: 'left' | 'right';
595
- /**
596
- * Allows changing the label displayed next to the CKEditor logo.
597
- *
598
- * **Note:** Set the value to `null` to hide the label.
599
- *
600
- * @default 'Powered by'
601
- */
602
- label: string | null;
603
- /**
604
- * The vertical distance the logo can be moved away from its default position.
605
- *
606
- * **Note:** If `position` is `'border'`, the offset is measured from the (vertical) center of the logo.
607
- *
608
- * @default 5
609
- */
610
- verticalOffset: number;
611
- /**
612
- * The horizontal distance between the side of the editing root and the nearest side of the logo.
613
- *
614
- * @default 5
615
- */
616
- horizontalOffset: number;
617
- /**
618
- * Allows to show the logo even if the valid commercial license is configured using
619
- * the {@link module:core/editor/editorconfig~EditorConfig#licenseKey `config.licenseKey`} setting.
620
- *
621
- * @default false
622
- */
623
- forceVisible?: boolean;
624
- }
625
- /**
626
- * The offset (in pixels) of the viewport from every direction used when positioning a sticky toolbar or other
627
- * absolutely positioned UI elements.
628
- */
629
- export interface ViewportOffsetConfig {
630
- /**
631
- * The bottom offset in pixels.
632
- */
633
- bottom?: number;
634
- /**
635
- * The left offset in pixels.
636
- */
637
- left?: number;
638
- /**
639
- * The right offset in pixels.
640
- */
641
- right?: number;
642
- /**
643
- * The top offset in pixels.
644
- */
645
- top?: number;
646
- }
647
- export interface UiConfig {
648
- /**
649
- * The viewport offset used for positioning various absolutely positioned UI elements.
650
- *
651
- * Read more in {@link module:core/editor/editorconfig~ViewportOffsetConfig}.
652
- **/
653
- viewportOffset?: ViewportOffsetConfig;
654
- /**
655
- * The configuration of the “Powered by CKEditor” logo.
656
- *
657
- * Read more in {@link module:core/editor/editorconfig~PoweredByConfig}.
658
- **/
659
- poweredBy?: PoweredByConfig;
660
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ /**
6
+ * @module core/editor/editorconfig
7
+ */
8
+ import type Context from '../context';
9
+ import type { PluginConstructor } from '../plugin';
10
+ import type Editor from './editor';
11
+ /**
12
+ * CKEditor configuration options.
13
+ *
14
+ * An object defining the editor configuration can be passed when initializing the editor:
15
+ *
16
+ * ```ts
17
+ * EditorClass
18
+ * .create( {
19
+ * toolbar: [ 'bold', 'italic' ],
20
+ * image: {
21
+ * styles: [
22
+ * ...
23
+ * ]
24
+ * }
25
+ * } )
26
+ * .then( ... )
27
+ * .catch( ... );
28
+ * ```
29
+ *
30
+ * Check the {@glink installation/getting-started/predefined-builds Configuration} guide for more information
31
+ * about setting configuration options.
32
+ */
33
+ export interface EditorConfig {
34
+ context?: Context;
35
+ /**
36
+ * The list of additional plugins to load along those already available in the
37
+ * {@glink installation/getting-started/predefined-builds editor build}. It extends the {@link #plugins `plugins`} configuration.
38
+ *
39
+ * ```ts
40
+ * function MyPlugin( editor ) {
41
+ * // ...
42
+ * }
43
+ *
44
+ * const config = {
45
+ * extraPlugins: [ MyPlugin ]
46
+ * };
47
+ * ```
48
+ *
49
+ * **Note:** This configuration works only for simple plugins which utilize the
50
+ * {@link module:core/plugin~PluginInterface plugin interface} and have no dependencies. To extend a
51
+ * build with complex features, create a
52
+ * {@glink installation/getting-started/quick-start-other#creating-custom-builds-with-online-builder custom build}.
53
+ *
54
+ * **Note:** Make sure you include the new features in you toolbar configuration. Learn more
55
+ * about the {@glink features/toolbar/toolbar toolbar setup}.
56
+ */
57
+ extraPlugins?: Array<PluginConstructor<Editor>>;
58
+ /**
59
+ * The initial editor data to be used instead of the provided element's HTML content.
60
+ *
61
+ * ```ts
62
+ * ClassicEditor
63
+ * .create( document.querySelector( '#editor' ), {
64
+ * initialData: '<h2>Initial data</h2><p>Foo bar.</p>'
65
+ * } )
66
+ * .then( ... )
67
+ * .catch( ... );
68
+ * ```
69
+ *
70
+ * By default, the editor is initialized with the content of the element on which this editor is initialized.
71
+ * This configuration option lets you override this behavior and pass different initial data.
72
+ * It is especially useful if it is difficult for your integration to put the data inside the HTML element.
73
+ *
74
+ * If your editor implementation uses multiple roots, you should pass an object with keys corresponding to the editor
75
+ * roots names and values equal to the data that should be set in each root:
76
+ *
77
+ * ```ts
78
+ * MultiRootEditor.create(
79
+ * // Roots for the editor:
80
+ * {
81
+ * header: document.querySelector( '#header' ),
82
+ * content: document.querySelector( '#content' ),
83
+ * leftSide: document.querySelector( '#left-side' ),
84
+ * rightSide: document.querySelector( '#right-side' )
85
+ * },
86
+ * // Config:
87
+ * {
88
+ * initialData: {
89
+ * header: '<p>Content for header part.</p>',
90
+ * content: '<p>Content for main part.</p>',
91
+ * leftSide: '<p>Content for left-side box.</p>',
92
+ * rightSide: '<p>Content for right-side box.</p>'
93
+ * }
94
+ * }
95
+ * )
96
+ * .then( ... )
97
+ * .catch( ... );
98
+ * ```
99
+ *
100
+ * See also {@link module:core/editor/editor~Editor.create Editor.create()} documentation for the editor implementation which you use.
101
+ *
102
+ * **Note:** If initial data is passed to `Editor.create()` in the first parameter (instead of a DOM element), and,
103
+ * at the same time, `config.initialData` is set, an error will be thrown as those two options exclude themselves.
104
+ *
105
+ * If `config.initialData` is not set when the editor is initialized, the data received in `Editor.create()` call
106
+ * will be used to set `config.initialData`. As a result, `initialData` is always set in the editor's config and
107
+ * plugins can read and/or modify it during initialization.
108
+ */
109
+ initialData?: string | Record<string, string>;
110
+ /**
111
+ * The language of the editor UI and its content.
112
+ *
113
+ * Note: You do not have to specify this option if your build is optimized for one UI language or if it is
114
+ * the default language (English is the default language for CDN builds), unless you want to change
115
+ * the language of your content.
116
+ *
117
+ * Simple usage (change the language of the UI and the content):
118
+ *
119
+ * ```ts
120
+ * ClassicEditor
121
+ * .create( document.querySelector( '#editor' ), {
122
+ * // The UI of the editor as well as its content will be in German.
123
+ * language: 'de'
124
+ * } )
125
+ * .then( editor => {
126
+ * console.log( editor );
127
+ * } )
128
+ * .catch( error => {
129
+ * console.error( error );
130
+ * } );
131
+ * ```
132
+ *
133
+ * Use different languages for the UI and the content using the {@link module:core/editor/editorconfig~LanguageConfig configuration}
134
+ * syntax:
135
+ *
136
+ * ```ts
137
+ * ClassicEditor
138
+ * .create( document.querySelector( '#editor' ), {
139
+ * language: {
140
+ * // The UI will be in English.
141
+ * ui: 'en',
142
+ *
143
+ * // But the content will be edited in Arabic.
144
+ * content: 'ar'
145
+ * }
146
+ * } )
147
+ * .then( editor => {
148
+ * console.log( editor );
149
+ * } )
150
+ * .catch( error => {
151
+ * console.error( error );
152
+ * } );
153
+ * ```
154
+ *
155
+ * The language of the content has an impact on the editing experience, for instance it affects screen readers
156
+ * and spell checkers. It is also particularly useful for typing in certain languages (e.g. right–to–left ones)
157
+ * because it changes the default alignment of the text.
158
+ *
159
+ * The language codes are defined in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) standard.
160
+ *
161
+ * You need to add the corresponding translation file for the new UI language to work.
162
+ * Translation files are available on CDN for predefined builds:
163
+ *
164
+ * ```html
165
+ * `<script src="https://cdn.ckeditor.com/ckeditor5/[version.number]/[distribution]/lang/[lang].js"></script>`
166
+ * ```
167
+ *
168
+ * But you can add them manually by coping from the `node_modules/@ckeditor/ckeditor5-build-[name]/build/lang/[lang].js'`.
169
+ *
170
+ * Check the {@glink features/ui-language UI language} guide for more information about the localization options and translation
171
+ * process.
172
+ */
173
+ language?: string | LanguageConfig;
174
+ /**
175
+ * Specifies the text displayed in the editor when there is no content (editor is empty). It is intended to
176
+ * help users locate the editor in the application (form) and prompt them to input the content. Work similarly
177
+ * as to the native DOM
178
+ * [`placeholder` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#The_placeholder_attribute)
179
+ * used by inputs.
180
+ *
181
+ * ```ts
182
+ * ClassicEditor
183
+ * .create( document.querySelector( '#editor' ), {
184
+ * placeholder: 'Type some text...'
185
+ * } )
186
+ * .then( ... )
187
+ * .catch( ... );
188
+ * ```
189
+ *
190
+ * If your editor implementation uses multiple roots, you should pass an object with keys corresponding to the editor
191
+ * roots names and values equal to the placeholder that should be set in each root:
192
+ *
193
+ * ```ts
194
+ * MultiRootEditor.create(
195
+ * // Roots for the editor:
196
+ * {
197
+ * header: document.querySelector( '#header' ),
198
+ * content: document.querySelector( '#content' ),
199
+ * leftSide: document.querySelector( '#left-side' ),
200
+ * rightSide: document.querySelector( '#right-side' )
201
+ * },
202
+ * // Config:
203
+ * {
204
+ * placeholder: {
205
+ * header: 'Type header...',
206
+ * content: 'Type content...',
207
+ * leftSide: 'Type left-side...',
208
+ * rightSide: 'Type right-side...'
209
+ * }
210
+ * }
211
+ * )
212
+ * .then( ... )
213
+ * .catch( ... );
214
+ * ```
215
+ *
216
+ * The placeholder text is displayed as a pseudo–element of an empty paragraph in the editor content.
217
+ * The paragraph has the `.ck-placeholder` CSS class and the `data-placeholder` attribute.
218
+ *
219
+ * ```html
220
+ * <p data-placeholder="Type some text..." class="ck-placeholder">
221
+ * ::before
222
+ * </p>
223
+ * ```
224
+ *
225
+ * **Note**: Placeholder text can also be set using the `placeholder` attribute if a `<textarea>` is passed to
226
+ * the `create()` method, e.g. {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`}.
227
+ *
228
+ * **Note**: This configuration has precedence over the value of the `placeholder` attribute of a `<textarea>`
229
+ * element passed to the `create()` method.
230
+ *
231
+ * See the {@glink features/editor-placeholder "Editor placeholder"} guide for more information and live examples.
232
+ */
233
+ placeholder?: string | Record<string, string>;
234
+ /**
235
+ * The list of plugins to load.
236
+ *
237
+ * If you use an {@glink installation/getting-started/predefined-builds editor build} you can define the list of plugins to load
238
+ * using the names of plugins that are available:
239
+ *
240
+ * ```ts
241
+ * const config = {
242
+ * plugins: [ 'Bold', 'Italic', 'Typing', 'Enter', ... ]
243
+ * };
244
+ * ```
245
+ *
246
+ * You can check the list of plugins available in a build using this snippet:
247
+ *
248
+ * ```ts
249
+ * ClassicEditor.builtinPlugins.map( plugin => plugin.pluginName );
250
+ * ```
251
+ *
252
+ * If you use an editor creator directly (imported from a package like `@ckeditor/ckeditor5-editor-classic`) or you
253
+ * want to load additional plugins which were not included in a build you use, then you need to specify
254
+ * the plugins using their constructors:
255
+ *
256
+ * ```ts
257
+ * // A preset of plugins is a plugin as well.
258
+ * import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
259
+ * // The bold plugin.
260
+ * import Bold from '@ckeditor/ckeditor5-editor-basic-styles/src/bold';
261
+ *
262
+ * const config = {
263
+ * plugins: [ Essentials, Bold ]
264
+ * };
265
+ * ```
266
+ *
267
+ * **Note:** To load additional plugins, you should use the {@link #extraPlugins `extraPlugins`} configuration.
268
+ * To narrow the list of loaded plugins, use the {@link #removePlugins `removePlugins`} configuration.
269
+ */
270
+ plugins?: Array<PluginConstructor<Editor> | string>;
271
+ /**
272
+ * The list of plugins which should not be loaded despite being available in an {@glink installation/getting-started/predefined-builds
273
+ * editor build}.
274
+ *
275
+ * ```ts
276
+ * const config = {
277
+ * removePlugins: [ 'Bold', 'Italic' ]
278
+ * };
279
+ * ```
280
+ *
281
+ * **Note:** Be careful when removing plugins using `config.removePlugins` from CKEditor builds.
282
+ * If removed plugins were providing toolbar buttons, the default toolbar configuration included in a build
283
+ * will become invalid. In such case you need to provide the updated
284
+ * {@link module:core/editor/editorconfig~EditorConfig#toolbar toolbar configuration}.
285
+ */
286
+ removePlugins?: Array<PluginConstructor<Editor> | string>;
287
+ substitutePlugins?: Array<PluginConstructor<Editor>>;
288
+ /**
289
+ * The editor toolbar configuration.
290
+ *
291
+ * Simple format (specifies only toolbar items):
292
+ *
293
+ * ```ts
294
+ * const config = {
295
+ * toolbar: [ 'bold', 'italic', '|', 'undo', 'redo' ]
296
+ * };
297
+ * ```
298
+ *
299
+ * Extended format:
300
+ *
301
+ * ```ts
302
+ * const config = {
303
+ * toolbar: {
304
+ * items: [ 'bold', 'italic', '|', 'undo', 'redo', '-', 'numberedList', 'bulletedList' ],
305
+ *
306
+ * shouldNotGroupWhenFull: true
307
+ * }
308
+ * };
309
+ * ```
310
+ *
311
+ * Options which can be set using the extended format:
312
+ *
313
+ * * **`toolbar.items`** &ndash; An array of toolbar item names. The components (buttons, dropdowns, etc.) which can be used
314
+ * as toolbar items are defined in `editor.ui.componentFactory` and can be listed using the following snippet:
315
+ *
316
+ * ```ts
317
+ * Array.from( editor.ui.componentFactory.names() );
318
+ * ```
319
+ *
320
+ * You can also use `'|'` to create a separator between groups of items:
321
+ *
322
+ * ```
323
+ * toolbar: [ 'bold', 'italic', '|', 'undo', 'redo' ]
324
+ * ```
325
+ *
326
+ * or `'-'` to make a line break and render items in multiple lines:
327
+ *
328
+ * ```
329
+ * toolbar: [ 'bold', 'italic', '-', 'undo', 'redo' ]
330
+ * ```
331
+ *
332
+ * Line break will work only in the extended format when `shouldNotGroupWhenFull` option is set to `true`.
333
+ *
334
+ * **Note**: To save space in your toolbar, you can group several items into a dropdown:
335
+ *
336
+ * ```
337
+ * toolbar: [
338
+ * {
339
+ * label: 'Basic styles',
340
+ * icon: 'text',
341
+ * items: [ 'bold', 'italic', ... ]
342
+ * },
343
+ * '|',
344
+ * 'undo', 'redo'
345
+ * ]
346
+ * ```
347
+ *
348
+ * The code above will create a "Basic styles" dropdown with a "text" icon containing the "bold" and "italic" buttons.
349
+ * You can customize the look of the dropdown by setting the `withText`, `icon`, and `tooltip` properties:
350
+ *
351
+ * * **Displaying a label**
352
+ *
353
+ * For instance, to hide the icon and to display the label only, you can use the following configuration:
354
+ *
355
+ * ```ts
356
+ * {
357
+ * label: 'Basic styles',
358
+ * // Show the textual label of the drop-down. Note that the "icon" property is not configured.
359
+ * withText: true,
360
+ * items: [ 'bold', 'italic', ... ]
361
+ * }
362
+ * ```
363
+ *
364
+ * * **Selecting an icon**
365
+ *
366
+ * You can use one of the common icons provided by the editor (`'bold'`, `'plus'`, `'text'`, `'importExport'`, `'alignLeft'`,
367
+ * `'paragraph'`, `'threeVerticalDots'`, `'dragIndicator'`, `'pilcrow'`):
368
+ *
369
+ * ```ts
370
+ * {
371
+ * label: '...',
372
+ * // A "plus" sign icon works best for content insertion tools.
373
+ * icon: 'plus',
374
+ * items: [ ... ]
375
+ * }
376
+ * ```
377
+ *
378
+ * If no icon is specified, `'threeVerticalDots'` will be used as a default:
379
+ *
380
+ * ```ts
381
+ * // No icon specified, using a default one.
382
+ * {
383
+ * label: 'Default icon',
384
+ * items: [ ... ]
385
+ * }
386
+ * ```
387
+ *
388
+ * If `icon: false` is configured, no icon will be displayed at all and the text label will show up instead:
389
+ *
390
+ * ```ts
391
+ * // This drop-down has no icon. The text label will be displayed instead.
392
+ * {
393
+ * label: 'No icon',
394
+ * icon: false,
395
+ * items: [ ... ]
396
+ * }
397
+ * ```
398
+ *
399
+ * You can also set a custom icon for the drop-down by passing an SVG string:
400
+ *
401
+ * ```ts
402
+ * {
403
+ * label: '...',
404
+ * // If you want your icon to change the color dynamically (e.g. when the dropdown opens), avoid fill="..."
405
+ * // and stroke="..." styling attributes. Use solid shapes and avoid paths with strokes.
406
+ * icon: '<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">...</svg>',
407
+ * items: [ ... ]
408
+ * }
409
+ * ```
410
+ *
411
+ * * **Customizing the tooltip**
412
+ *
413
+ * By default, the tooltip of the button shares its text with the label. You can customize it to better describe your dropdown
414
+ * using the `tooltip` property ({@link module:ui/button/buttonview~ButtonView#tooltip learn more}):
415
+ *
416
+ * ```ts
417
+ * {
418
+ * label: 'Drop-down label',
419
+ * tooltip: 'Custom tooltip of the drop-down',
420
+ * icon: '...',
421
+ * items: [ ... ]
422
+ * }
423
+ * ```
424
+ *
425
+ * * **`toolbar.viewportTopOffset` (deprecated)** &ndash; The offset (in pixels) from the top of the viewport used when positioning a
426
+ * sticky toolbar.
427
+ * Useful when a page with which the editor is being integrated has some other sticky or fixed elements
428
+ * (e.g. the top menu). Thanks to setting the toolbar offset the toolbar will not be positioned underneath or above the page's UI.
429
+ *
430
+ * **This property has been deprecated and will be removed in the future versions of CKEditor. Please use
431
+ * `{@link module:core/editor/editorconfig~EditorConfig#ui EditorConfig#ui.viewportOffset}` instead.**
432
+ *
433
+ * * **`toolbar.shouldNotGroupWhenFull`** &ndash; When set to `true`, the toolbar will stop grouping items
434
+ * and let them wrap to the next line if there is not enough space to display them in a single row.
435
+ */
436
+ toolbar?: ToolbarConfig;
437
+ /**
438
+ * The editor UI configuration.
439
+ *
440
+ * ```ts
441
+ * ClassicEditor
442
+ * .create( document.querySelector( '#editor' ), {
443
+ * ui: { ... }
444
+ * } )
445
+ * .then( ... )
446
+ * .catch( ... );
447
+ * ```
448
+ *
449
+ * Options which can be set using the UI configuration:
450
+ *
451
+ * * **`ui.viewportOffset`** &ndash; The offset (in pixels) of the viewport from every direction. It is
452
+ * used when positioning a sticky toolbar or other absolutely positioned UI elements.
453
+ * Useful when a page with which the editor is being integrated has some other sticky or fixed elements
454
+ * (e.g. the top menu). Thanks to setting the UI viewport offset, the toolbar and other contextual balloons will not be positioned
455
+ * underneath or above the page's UI.
456
+ *
457
+ * ```ts
458
+ * ui: {
459
+ * viewportOffset: { top: 10, right: 10, bottom: 10, left: 10 }
460
+ * }
461
+ * ```
462
+ *
463
+ * **Note:** If you want to modify the viewport offset in runtime (after the editor was created), you can do that by overriding
464
+ * {@link module:ui/editorui/editorui~EditorUI#viewportOffset `editor.ui.viewportOffset`}.
465
+ *
466
+ * * **`ui.poweredBy`** &ndash; The configuration of the project logo displayed over the editor's editing area in
467
+ * open-source integrations. It allows customizing the position of the logo to minimize the risk of collision with the
468
+ * editor content and UI.
469
+ *
470
+ * The following configuration properties are supported:
471
+ *
472
+ * * **`position`** &ndash; The position of the project's logo (default: `'border'`).
473
+ * * When `'inside'`, the logo will be displayed within the boundaries of the editing area.
474
+ * * When `'border'`, the logo will be displayed over the bottom border of the editing area.
475
+ *
476
+ * * **`side`** (`'left'` or `'right'`, default: `'right'`) &ndash; The side of the editing area where the
477
+ * logo will be displayed.
478
+ *
479
+ * **Note**: If {@link module:core/editor/editorconfig~EditorConfig#language `config.language`} is set to an RTL (right-to-left)
480
+ * language, the side switches to `'left'` by default.
481
+ *
482
+ * * **`label`** (default: `'Powered by'`) &ndash; The label displayed next to the project's logo.
483
+ *
484
+ * **Note**: Set the value to `null` to display the logo without any text.
485
+ *
486
+ * * **`verticalOffset`** (default: `5`) &ndash; The vertical distance the logo can be moved away from its default position.
487
+ *
488
+ * **Note**: If `position` is `'border'`, the offset is measured from the (vertical) center of the logo.
489
+ *
490
+ * * **`horizontalOffset`** (default: `5`) &ndash; The horizontal distance between the side of the editing root and the
491
+ * nearest side of the logo.
492
+ *
493
+ * ```ts
494
+ * ui: {
495
+ * poweredBy: {
496
+ * position: 'border',
497
+ * side: 'left',
498
+ * verticalOffset: 2,
499
+ * horizontalOffset: 30
500
+ * }
501
+ * }
502
+ */
503
+ ui?: UiConfig;
504
+ /**
505
+ * Enables updating the source element after the editor is destroyed.
506
+ *
507
+ * Enabling this option might have some security implications, as the editor doesn't have control over all data
508
+ * in the output.
509
+ *
510
+ * Be careful, especially while using the
511
+ * {@glink features/markdown Markdown}, {@glink features/html/general-html-support General HTML Support}, or
512
+ * {@glink features/html/html-embed HTML embed} features.
513
+ */
514
+ updateSourceElementOnDestroy?: boolean;
515
+ /**
516
+ * The license key for the CKEditor 5 commercial license and the premium features.
517
+ *
518
+ * If you do not have a key yet, please [contact us](https://ckeditor.com/contact/) or
519
+ * [order a trial](https://orders.ckeditor.com/trial/premium-features).
520
+ */
521
+ licenseKey?: string;
522
+ }
523
+ /**
524
+ * The `config.initialData` option cannot be used together with the initial data passed as the first parameter of
525
+ * {@link module:core/editor/editor~Editor.create `Editor.create()`}.
526
+ *
527
+ * @error editor-create-initial-data
528
+ */
529
+ /**
530
+ * The configuration of the editor language.
531
+ *
532
+ * ```ts
533
+ * ClassicEditor
534
+ * .create( document.querySelector( '#editor' ), {
535
+ * language: ... // The editor language configuration.
536
+ * } )
537
+ * .then( editor => {
538
+ * console.log( editor );
539
+ * } )
540
+ * .catch( error => {
541
+ * console.error( error );
542
+ * } );
543
+ * ```
544
+ *
545
+ * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
546
+ */
547
+ export interface LanguageConfig {
548
+ /**
549
+ * Allows to use a different language for the editor UI.
550
+ *
551
+ * The language codes are defined in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) standard.
552
+ */
553
+ ui?: string;
554
+ /**
555
+ * Allows to use a different language of the editor content.
556
+ *
557
+ * The language codes are defined in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) standard.
558
+ */
559
+ content?: string;
560
+ }
561
+ export type ToolbarConfig = Array<ToolbarConfigItem> | {
562
+ items?: Array<ToolbarConfigItem>;
563
+ removeItems?: Array<string>;
564
+ shouldNotGroupWhenFull?: boolean;
565
+ icon?: string;
566
+ };
567
+ export type ToolbarConfigItem = string | {
568
+ items: Array<ToolbarConfigItem>;
569
+ label: string;
570
+ icon?: string | false;
571
+ withText?: boolean;
572
+ tooltip?: boolean | string | ((label: string, keystroke: string | undefined) => string);
573
+ };
574
+ /**
575
+ * The “Powered by CKEditor” logo configuration options.
576
+ **/
577
+ export interface PoweredByConfig {
578
+ /**
579
+ * The position of the project's logo.
580
+ *
581
+ * * When `'inside'`, the logo will be displayed within the boundaries of the editing area.
582
+ * * When `'border'`, the logo will be displayed over the bottom border of the editing area.
583
+ *
584
+ * @default 'border'
585
+ */
586
+ position: 'inside' | 'border';
587
+ /**
588
+ * Allows choosing the side of the editing area where the logo will be displayed.
589
+ *
590
+ * **Note:** If {@link module:core/editor/editorconfig~EditorConfig#language `config.language`} is set to an RTL (right-to-left)
591
+ * language, the side switches to `'left'` by default.
592
+ *
593
+ * @default 'right'
594
+ */
595
+ side: 'left' | 'right';
596
+ /**
597
+ * Allows changing the label displayed next to the CKEditor logo.
598
+ *
599
+ * **Note:** Set the value to `null` to hide the label.
600
+ *
601
+ * @default 'Powered by'
602
+ */
603
+ label: string | null;
604
+ /**
605
+ * The vertical distance the logo can be moved away from its default position.
606
+ *
607
+ * **Note:** If `position` is `'border'`, the offset is measured from the (vertical) center of the logo.
608
+ *
609
+ * @default 5
610
+ */
611
+ verticalOffset: number;
612
+ /**
613
+ * The horizontal distance between the side of the editing root and the nearest side of the logo.
614
+ *
615
+ * @default 5
616
+ */
617
+ horizontalOffset: number;
618
+ /**
619
+ * Allows to show the logo even if the valid commercial license is configured using
620
+ * the {@link module:core/editor/editorconfig~EditorConfig#licenseKey `config.licenseKey`} setting.
621
+ *
622
+ * @default false
623
+ */
624
+ forceVisible?: boolean;
625
+ }
626
+ /**
627
+ * The offset (in pixels) of the viewport from every direction used when positioning a sticky toolbar or other
628
+ * absolutely positioned UI elements.
629
+ */
630
+ export interface ViewportOffsetConfig {
631
+ /**
632
+ * The bottom offset in pixels.
633
+ */
634
+ bottom?: number;
635
+ /**
636
+ * The left offset in pixels.
637
+ */
638
+ left?: number;
639
+ /**
640
+ * The right offset in pixels.
641
+ */
642
+ right?: number;
643
+ /**
644
+ * The top offset in pixels.
645
+ */
646
+ top?: number;
647
+ }
648
+ export interface UiConfig {
649
+ /**
650
+ * The viewport offset used for positioning various absolutely positioned UI elements.
651
+ *
652
+ * Read more in {@link module:core/editor/editorconfig~ViewportOffsetConfig}.
653
+ **/
654
+ viewportOffset?: ViewportOffsetConfig;
655
+ /**
656
+ * The configuration of the “Powered by CKEditor” logo.
657
+ *
658
+ * Read more in {@link module:core/editor/editorconfig~PoweredByConfig}.
659
+ **/
660
+ poweredBy?: PoweredByConfig;
661
+ }