UNPKG

27.2 kBTypeScriptView Raw
1/**
2 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4 */
5/**
6 * @module image/imageconfig
7 */
8/**
9 * The configuration of the image features. Used by the image features in the `@ckeditor/ckeditor5-image` package.
10 *
11 * ```ts
12 * ClassicEditor
13 * .create( editorElement, {
14 * image: ... // Image feature options.
15 * } )
16 * .then( ... )
17 * .catch( ... );
18 * ```
19 *
20 * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
21 */
22export interface ImageConfig {
23 /**
24 * The image insert configuration.
25 */
26 insert?: ImageInsertConfig;
27 /**
28 * The image resize options.
29 *
30 * Each option should have at least these two properties:
31 *
32 * * name: The name of the UI component registered in the global
33 * {@link module:ui/editorui/editorui~EditorUI#componentFactory component factory} of the editor,
34 * representing the button a user can click to change the size of an image,
35 * * value: An actual image width applied when a user clicks the mentioned button
36 * ({@link module:image/imageresize/resizeimagecommand~ResizeImageCommand} gets executed).
37 * The value property is combined with the
38 * {@link module:image/imageconfig~ImageConfig#resizeUnit `config.image.resizeUnit`} (`%` by default).
39 * For instance: `value: '50'` and `resizeUnit: '%'` will render as `'50%'` in the UI.
40 *
41 * **Resetting the image size**
42 *
43 * If you want to set an option that will reset image to its original size, you need to pass a `null` value
44 * to one of the options. The `:original` token is not mandatory, you can call it anything you wish, but it must reflect
45 * in the standalone buttons configuration for the image toolbar.
46 *
47 * ```ts
48 * ClassicEditor
49 * .create( editorElement, {
50 * image: {
51 * resizeUnit: "%",
52 * resizeOptions: [ {
53 * name: 'resizeImage:original',
54 * value: null
55 * },
56 * {
57 * name: 'resizeImage:50',
58 * value: '50'
59 * },
60 * {
61 * name: 'resizeImage:75',
62 * value: '75'
63 * } ]
64 * }
65 * } )
66 * .then( ... )
67 * .catch( ... );
68 * ```
69 *
70 * **Resizing images using a dropdown**
71 *
72 * With resize options defined, you can decide whether you want to display them as a dropdown or as standalone buttons.
73 * For the dropdown, you need to pass only the `resizeImage` token to the
74 {@link module:image/imageconfig~ImageConfig#toolbar `config.image.toolbar`}. The dropdown contains all defined options by default:
75 *
76 * ```ts
77 * ClassicEditor
78 * .create( editorElement, {
79 * image: {
80 * resizeUnit: "%",
81 * resizeOptions: [ {
82 * name: 'resizeImage:original',
83 * value: null
84 * },
85 * {
86 * name: 'resizeImage:50',
87 * value: '50'
88 * },
89 * {
90 * name: 'resizeImage:75',
91 * value: '75'
92 * } ],
93 * toolbar: [ 'resizeImage', ... ],
94 * }
95 * } )
96 * .then( ... )
97 * .catch( ... );
98 * ```
99 *
100 * **Resizing images using individual buttons**
101 *
102 * If you want to have separate buttons for {@link module:image/imageconfig~ImageResizeOption each option},
103 * pass their names to the {@link module:image/imageconfig~ImageConfig#toolbar `config.image.toolbar`} instead. Please keep in mind
104 * that this time **you must define the additional
105 * {@link module:image/imageconfig~ImageResizeOption `icon` property}**:
106 *
107 * ```ts
108 * ClassicEditor
109 * .create( editorElement, {
110 * image: {
111 * resizeUnit: "%",
112 * resizeOptions: [ {
113 * name: 'resizeImage:original',
114 * value: null,
115 * icon: 'original'
116 * },
117 * {
118 * name: 'resizeImage:25',
119 * value: '25',
120 * icon: 'small'
121 * },
122 * {
123 * name: 'resizeImage:50',
124 * value: '50',
125 * icon: 'medium'
126 * },
127 * {
128 * name: 'resizeImage:75',
129 * value: '75',
130 * icon: 'large'
131 * } ],
132 * toolbar: [ 'resizeImage:25', 'resizeImage:50', 'resizeImage:75', 'resizeImage:original', ... ],
133 * }
134 * } )
135 * .then( ... )
136 * .catch( ... );
137 * ```
138 *
139 * **Customizing resize button labels**
140 *
141 * You can set your own label for each resize button. To do that, add the `label` property like in the example below.
142 *
143 * * When using the **dropdown**, the labels are displayed on the list of all options when you open the dropdown.
144 * * When using **standalone buttons**, the labels will are displayed as tooltips when a user hovers over the button.
145 *
146 * ```ts
147 * ClassicEditor
148 * .create( editorElement, {
149 * image: {
150 * resizeUnit: "%",
151 * resizeOptions: [ {
152 * name: 'resizeImage:original',
153 * value: null,
154 * label: 'Original size'
155 * // Note: add the "icon" property if you're configuring a standalone button.
156 * },
157 * {
158 * name: 'resizeImage:50',
159 * value: '50',
160 * label: 'Medium size'
161 * // Note: add the "icon" property if you're configuring a standalone button.
162 * },
163 * {
164 * name: 'resizeImage:75',
165 * value: '75',
166 * label: 'Large size'
167 * // Note: add the "icon" property if you're configuring a standalone button.
168 * } ]
169 * }
170 * } )
171 * .then( ... )
172 * .catch( ... );
173 * ```
174 *
175 * **Default value**
176 *
177 * The following configuration is used by default:
178 *
179 * ```ts
180 * resizeOptions = [
181 * {
182 * name: 'resizeImage:original',
183 * value: null,
184 * icon: 'original'
185 * },
186 * {
187 * name: 'resizeImage:25',
188 * value: '25',
189 * icon: 'small'
190 * },
191 * {
192 * name: 'resizeImage:50',
193 * value: '50',
194 * icon: 'medium'
195 * },
196 * {
197 * name: 'resizeImage:75',
198 * value: '75',
199 * icon: 'large'
200 * }
201 * ];
202 * ```
203 */
204 resizeOptions?: Array<ImageResizeOption>;
205 /**
206 * The available options are `'px'` or `'%'`.
207 *
208 * Determines the size unit applied to the resized image.
209 *
210 * ```ts
211 * ClassicEditor
212 * .create( editorElement, {
213 * image: {
214 * resizeUnit: 'px'
215 * }
216 * } )
217 * .then( ... )
218 * .catch( ... );
219 * ```
220 *
221 * This option is used by the {@link module:image/imageresize~ImageResize} feature.
222 *
223 * @default '%'
224 */
225 resizeUnit?: 'px' | '%';
226 /**
227 * The {@link module:image/imagestyle `ImageStyle`} plugin requires a list of the
228 * {@link module:image/imageconfig~ImageStyleConfig#options image style options} to work properly.
229 * The default configuration is provided (listed below) and can be customized while creating the editor instance.
230 *
231 * # **Command**
232 *
233 * The {@link module:image/imagestyle/imagestylecommand~ImageStyleCommand `imageStyleCommand`}
234 * is configured based on the defined options,
235 * so you can change the style of the selected image by executing the following command:
236 *
237 * ```ts
238 * editor.execute( 'imageStyle' { value: 'alignLeft' } );
239 * ```
240 *
241 * # **Buttons**
242 *
243 * All of the image style options provided in the configuration are registered
244 * in the {@link module:ui/componentfactory~ComponentFactory UI components factory} with the "imageStyle:" prefixes and can be used
245 * in the {@link module:image/imageconfig~ImageConfig#toolbar image toolbar configuration}. The buttons available by default depending
246 * on the loaded plugins are listed in the next section.
247 *
248 * Read more about styling images in the {@glink features/images/images-styles Image styles guide}.
249 *
250 * # **Default options and buttons**
251 *
252 * If the custom configuration is not provided, the default configuration will be used depending on the loaded
253 * image editing plugins.
254 *
255 * * If both {@link module:image/image/imageblockediting~ImageBlockEditing `ImageBlockEditing`} and
256 * {@link module:image/image/imageinlineediting~ImageInlineEditing `ImageInlineEditing`} plugins are loaded
257 * (which is usually the default editor configuration), the following options will be available for the toolbar
258 * configuration. These options will be registered as the buttons with the "imageStyle:" prefixes.
259 *
260 * ```ts
261 * const imageDefaultConfig = {
262 * styles: {
263 * options: [
264 * 'inline', 'alignLeft', 'alignRight',
265 * 'alignCenter', 'alignBlockLeft', 'alignBlockRight',
266 * 'block', 'side'
267 * ]
268 * }
269 * };
270 * ```
271 *
272 * * If only the {@link module:image/image/imageblockediting~ImageBlockEditing `ImageBlockEditing`} plugin is loaded,
273 * the following buttons (options) and groups will be available for the toolbar configuration.
274 * These options will be registered as the buttons with the "imageStyle:" prefixes.
275 *
276 * ```ts
277 * const imageDefaultConfig = {
278 * styles: {
279 * options: [ 'block', 'side' ]
280 * }
281 * };
282 * ```
283 *
284 * * If only the {@link module:image/image/imageinlineediting~ImageInlineEditing `ImageInlineEditing`} plugin is loaded,
285 * the following buttons (options) and groups will available for the toolbar configuration.
286 * These options will be registered as the buttons with the "imageStyle:" prefixes.
287 *
288 * ```ts
289 * const imageDefaultConfig = {
290 * styles: {
291 * options: [ 'inline', 'alignLeft', 'alignRight' ]
292 * }
293 * };
294 * ```
295 *
296 * Read more about the {@link module:image/imagestyle/utils#DEFAULT_OPTIONS default styling options}.
297 *
298 * # **Custom configuration**
299 *
300 * The image styles configuration can be customized in several ways:
301 *
302 * * Any of the {@link module:image/imagestyle/utils#DEFAULT_OPTIONS default styling options}
303 * can be loaded by the reference to its name as follows:
304 *
305 * ```ts
306 * ClassicEditor
307 * .create( editorElement, {
308 * image: {
309 * styles: {
310 * options: [ 'alignLeft', 'alignRight' ]
311 * }
312 * }
313 * } );
314 * ```
315 *
316 * * Each of the {@link module:image/imagestyle/utils#DEFAULT_OPTIONS default image style options} can be customized,
317 * e.g. to change the `icon`, `title` or CSS `className` of the style. The feature also provides several
318 * {@link module:image/imagestyle/utils#DEFAULT_ICONS default icons} to choose from.
319 *
320 * ```ts
321 * import customIcon from 'custom-icon.svg';
322 *
323 * // ...
324 *
325 * ClassicEditor.create( editorElement, { image:
326 * styles: {
327 * options: {
328 * // This will only customize the icon of the "block" style.
329 * // Note: 'right' is one of default icons provided by the feature.
330 * {
331 * name: 'block',
332 * icon: 'right'
333 * },
334 *
335 * // This will customize the icon, title and CSS class of the default "side" style.
336 * {
337 * name: 'side',
338 * icon: customIcon,
339 * title: 'My side style',
340 * className: 'custom-side-image'
341 * }
342 * }
343 * }
344 * } );
345 * ```
346 *
347 * * If none of the {@link module:image/imagestyle/utils#DEFAULT_OPTIONS default image style options}
348 * works for the integration, it is possible to define independent custom styles, too.
349 *
350 * See the documentation about the image style {@link module:image/imageconfig~ImageStyleOptionDefinition options}
351 * to define the custom image style configuration properly.
352 *
353 * ```ts
354 * import redIcon from 'red-icon.svg';
355 * import blueIcon from 'blue-icon.svg';
356 *
357 * // ...
358 *
359 * ClassicEditor.create( editorElement, { image:
360 * styles: {
361 * // A list of completely custom styling options.
362 * options: [
363 * {
364 * name: 'regular',
365 * modelElements: [ 'imageBlock', 'imageInline' ],
366 * title: 'Regular image',
367 * icon: 'full',
368 * isDefault: true
369 * }, {
370 * name: 'blue',
371 * modelElements: [ 'imageInline' ],
372 * title: 'Blue image',
373 * icon: blueIcon,
374 * className: 'image-blue'
375 * }, {
376 * name: 'red',
377 * modelElements: [ 'imageBlock' ],
378 * title: 'Red image',
379 * icon: redIcon,
380 * className: 'image-red'
381 * }
382 * ]
383 * }
384 * } );
385 * ```
386 */
387 styles?: ImageStyleConfig;
388 /**
389 * Items to be placed in the image toolbar.
390 * This option is used by the {@link module:image/imagetoolbar~ImageToolbar} feature.
391 *
392 * Assuming that you use the following features:
393 *
394 * * {@link module:image/imagestyle~ImageStyle} (with a default configuration),
395 * * {@link module:image/imagetextalternative~ImageTextAlternative},
396 * * {@link module:image/imagecaption~ImageCaption},
397 *
398 * the following toolbar items will be available in {@link module:ui/componentfactory~ComponentFactory}:
399 * * `'imageTextAlternative'`,
400 * * `'toggleImageCaption'`,
401 * * {@link module:image/imageconfig~ImageConfig#styles buttons provided by the `ImageStyle` plugin},
402 * * {@link module:image/imagestyle/utils#DEFAULT_DROPDOWN_DEFINITIONS drop-downs provided by the `ImageStyle` plugin},
403 *
404 * so you can configure the toolbar like this:
405 *
406 * ```ts
407 * const imageConfig = {
408 * toolbar: [
409 * 'imageStyle:inline', 'imageStyle:wrapText', 'imageStyle:breakText', '|',
410 * 'toggleImageCaption', 'imageTextAlternative'
411 * ]
412 * };
413 * ```
414 *
415 * Besides that, the `ImageStyle` plugin allows to define a
416 * {@link module:image/imageconfig~ImageStyleDropdownDefinition custom drop-down} while configuring the toolbar.
417 *
418 * The same items can also be used in the {@link module:core/editor/editorconfig~EditorConfig#toolbar main editor toolbar}.
419 *
420 * Read more about configuring toolbar in {@link module:core/editor/editorconfig~EditorConfig#toolbar}.
421 */
422 toolbar?: Array<string | ImageStyleDropdownDefinition>;
423 /**
424 * The image upload configuration.
425 */
426 upload?: ImageUploadConfig;
427}
428/**
429 * The configuration of the image insert dropdown panel view. Used by the image insert feature in the `@ckeditor/ckeditor5-image` package.
430 *
431 * ```ts
432 * ClassicEditor
433 * .create( editorElement, {
434 * image: {
435 * insert: {
436 * ... // settings for "insertImage" view goes here
437 * }
438 * }
439 * } )
440 * .then( ... )
441 * .catch( ... );
442 * ```
443 *
444 * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
445 */
446export interface ImageInsertConfig {
447 /**
448 * The image insert panel view configuration contains a list of {@link module:image/imageinsert~ImageInsert} integrations.
449 *
450 * The option accepts string tokens.
451 * * for predefined integrations, we have 3 special strings: `upload`, `url`, and `assetManager`.
452 * * for custom integrations, each string should be a name of the integration registered by the
453 * {@link module:image/imageinsert/imageinsertui~ImageInsertUI#registerIntegration `ImageInsertUI#registerIntegration()`}.
454 *
455 * ```ts
456 * // Add `upload`, `assetManager` and `url` integrations.
457 * const imageInsertConfig = {
458 * insert: {
459 * integrations: [
460 * 'upload',
461 * 'assetManager',
462 * 'url'
463 * ]
464 * }
465 * };
466 * ```
467 *
468 * @default [ 'upload', 'assetManager', 'url' ]
469 */
470 integrations?: Array<string>;
471 /**
472 * This option allows to override the image type used by the {@link module:image/image/insertimagecommand~InsertImageCommand}
473 * when the user inserts new images into the editor content. By default, all images inserted into the editor will be block
474 * if {@link module:image/imageblock~ImageBlock} is loaded. To let the editor decide the image type, choose `'auto'`.
475 *
476 * Available options are:
477 *
478 * * `'block'` – all images inserted into the editor will be block (requires the {@link module:image/imageblock~ImageBlock} plugin),
479 * * `'inline'` – all images inserted into the editor will be inline (requires the {@link module:image/imageinline~ImageInline} plugin),
480 * * `'auto'` – the editor will choose the optimal image type based on the context of the insertion and availability of plugins.
481 *
482 * @default 'block'
483 */
484 type?: 'inline' | 'block' | 'auto';
485}
486/**
487 * The image resize option used in the {@link module:image/imageconfig~ImageConfig#resizeOptions image resize configuration}.
488 */
489export interface ImageResizeOption {
490 /**
491 * The name of the UI component that changes the image size.
492 * * If you configure the feature using individual resize buttons, you can refer to this name in the
493 * {@link module:image/imageconfig~ImageConfig#toolbar image toolbar configuration}.
494 * * If you configure the feature using the resize dropdown, this name will be used for a list item in the dropdown.
495 */
496 name: string;
497 /**
498 *
499 * The value of the resize option without the unit
500 * ({@link module:image/imageconfig~ImageConfig#resizeUnit configured separately}). `null` resets an image to its original size.
501 */
502 value: string | null;
503 /**
504 * An icon used by an individual resize button (see the `name` property to learn more).
505 * Available icons are: `'small'`, `'medium'`, `'large'`, `'original'`.
506 */
507 icon?: string;
508 /**
509 * An option label displayed in the dropdown or, if the feature is configured using
510 * individual buttons, a {@link module:ui/button/buttonview~ButtonView#tooltip} and an ARIA attribute of a button.
511 * If not specified, the label is generated automatically based on the `value` option and the
512 * {@link module:image/imageconfig~ImageConfig#resizeUnit `config.image.resizeUnit`}.
513 */
514 label?: string;
515}
516/**
517 * # **The image style custom drop-down definition descriptor**
518 *
519 * This definition can be implemented in the {@link module:image/imageconfig~ImageConfig#toolbar image toolbar configuration}
520 * to define a completely custom drop-down in the image toolbar.
521 *
522 * ```ts
523 * ClassicEditor.create( editorElement, {
524 * image: { toolbar: [
525 * // One of the predefined drop-downs
526 * 'imageStyle:wrapText',
527 * // Custom drop-down
528 * {
529 * name: 'imageStyle:customDropdown',
530 * title: Custom drop-down title,
531 * items: [ 'imageStyle:alignLeft', 'imageStyle:alignRight' ],
532 * defaultItem: 'imageStyle:alignLeft'
533 * }
534 * ] }
535 * } );
536 * ```
537 *
538 * **Note:** At the moment it is possible to populate the custom drop-down with only the buttons registered by the `ImageStyle` plugin.
539 *
540 * The defined drop-down will be registered
541 * as the {@link module:ui/dropdown/dropdownview~DropdownView}
542 * with the {@link module:ui/dropdown/button/splitbuttonview~SplitButtonView} under the provided name in the
543 * {@link module:ui/componentfactory~ComponentFactory}
544 */
545export interface ImageStyleDropdownDefinition {
546 /**
547 * The unique name of the drop-down. It is recommended to precede it with the "imageStyle:" prefix
548 * to avoid collision with the components' names registered by other plugins.
549 */
550 name: string;
551 /**
552 * The drop-down's title. It will be used as the split button label along with the title of the default item
553 * in the following manner: "Custom drop-down title: Default item title".
554 *
555 * Setting `title` to one of
556 * {@link module:image/imagestyle/imagestyleui~ImageStyleUI#localizedDefaultStylesTitles}
557 * will automatically translate it to the language of the editor.
558 */
559 title?: string;
560 /**
561 * The list of the names of the buttons that will be placed in the drop-down's toolbar.
562 * Each of the buttons has to be one of the {@link module:image/imageconfig~ImageConfig#styles default image style buttons}
563 * or to be defined as the {@link module:image/imageconfig~ImageStyleOptionDefinition image styling option}.
564 */
565 items: Array<string>;
566 /**
567 * defaultItem The name of one of the buttons from the items list,
568 * which will be used as a default button for the drop-down's split button.
569 */
570 defaultItem: string;
571}
572/**
573 * The configuration for the {@link module:image/imagestyle~ImageStyle} plugin that should be provided
574 * while creating the editor instance.
575 *
576 * A detailed information about the default configuration and customization can be found in
577 * {@link module:image/imageconfig~ImageConfig#styles `ImageConfig#styles`}.
578 */
579export interface ImageStyleConfig {
580 /**
581 * A list of the image style options.
582 */
583 options?: Array<string | ImageStyleOptionDefinition>;
584}
585/**
586 * The image styling option definition descriptor.
587 *
588 * This definition should be implemented in the `Image` plugin {@link module:image/imageconfig~ImageConfig#styles configuration} for:
589 *
590 * * customizing one of the {@link module:image/imagestyle/utils#DEFAULT_OPTIONS default styling options} by providing the proper name
591 * of the default style and the properties that should be overridden,
592 * * or defining a completely custom styling option by providing a custom name and implementing the following properties.
593 *
594 * ```ts
595 * import fullSizeIcon from 'path/to/icon.svg';
596 *
597 * const imageStyleOptionDefinition = {
598 * name: 'fullSize',
599 * icon: fullSizeIcon,
600 * title: 'Full size image',
601 * className: 'image-full-size',
602 * modelElements: [ 'imageBlock', 'imageInline' ]
603 * }
604 * ```
605 *
606 * The styling option will be registered as the button under the name `'imageStyle:{name}'` in the
607 * {@link module:ui/componentfactory~ComponentFactory UI components factory} (this functionality is provided by the
608 * {@link module:image/imagestyle/imagestyleui~ImageStyleUI} plugin).
609 */
610export interface ImageStyleOptionDefinition {
611 /**
612 * The unique name of the styling option. It will be used to:
613 *
614 * * refer to one of the {@link module:image/imagestyle/utils#DEFAULT_OPTIONS default styling options} or define the custom style,
615 * * store the chosen style in the model by setting the `imageStyle` attribute of the model image element,
616 * * as a value of the {@link module:image/imagestyle/imagestylecommand~ImageStyleCommand#execute `imageStyle` command},
617 * * when registering a button for the style in the following manner: (`'imageStyle:{name}'`).
618 */
619 name: string;
620 /**
621 * When set, the style will be used as the default one for the model elements
622 * listed in the `modelElements` property. A default style does not apply any CSS class to the view element.
623 *
624 * If this property is not defined, its value is inherited
625 * from the {@link module:image/imagestyle/utils#DEFAULT_OPTIONS default styling options} addressed in the name property.
626 */
627 isDefault?: boolean;
628 /**
629 * One of the following to be used when creating the styles's button:
630 *
631 * * an SVG icon source (as an XML string),
632 * * one of the keys in {@link module:image/imagestyle/utils#DEFAULT_ICONS} to use one of default icons provided by the plugin.
633 *
634 * If this property is not defined, its value is inherited
635 * from the {@link module:image/imagestyle/utils#DEFAULT_OPTIONS default styling options} addressed in the name property.
636 */
637 icon: string;
638 /**
639 * The styles's title. Setting `title` to one of
640 * {@link module:image/imagestyle/imagestyleui~ImageStyleUI#localizedDefaultStylesTitles}
641 * will automatically translate it to the language of the editor.
642 *
643 * If this property is not defined, its value is inherited
644 * from the {@link module:image/imagestyle/utils#DEFAULT_OPTIONS default styling options} addressed in the name property.
645 */
646 title: string;
647 /**
648 * The CSS class used to represent the style in the view.
649 * It should be used only for the non-default styles.
650 *
651 * If this property is not defined, its value is inherited
652 * from the {@link module:image/imagestyle/utils#DEFAULT_OPTIONS default styling options} addressed in the name property.
653 */
654 className?: string;
655 /**
656 * The list of the names of the model elements that are supported by the style.
657 * The possible values are:
658 * * `[ 'imageBlock' ]` if the style can be applied to the image type introduced by the
659 * {@link module:image/image/imageblockediting~ImageBlockEditing `ImageBlockEditing`} plugin,
660 * * `[ 'imageInline' ]` if the style can be applied to the image type introduced by the
661 * {@link module:image/image/imageinlineediting~ImageInlineEditing `ImageInlineEditing`} plugin,
662 * * `[ 'imageInline', 'imageBlock' ]` if the style can be applied to both image types introduced by the plugins mentioned above.
663 *
664 * This property determines which model element names work with the style. If the model element name of the currently selected
665 * image is different, upon executing the
666 * {@link module:image/imagestyle/imagestylecommand~ImageStyleCommand#execute `imageStyle`} command the image type (model element name)
667 * will automatically change.
668 *
669 * If this property is not defined, its value is inherited
670 * from the {@link module:image/imagestyle/utils#DEFAULT_OPTIONS default styling options} addressed in the name property.
671 */
672 modelElements: Array<string>;
673}
674/**
675 * The configuration of the image upload feature. Used by the image upload feature in the `@ckeditor/ckeditor5-image` package.
676 *
677 * ```ts
678 * ClassicEditor
679 * .create( editorElement, {
680 * image: {
681 * upload: ... // Image upload feature options.
682 * }
683 * } )
684 * .then( ... )
685 * .catch( ... );
686 * ```
687 *
688 * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
689 */
690export interface ImageUploadConfig {
691 /**
692 * The list of accepted image types.
693 *
694 * The accepted types of images can be customized to allow only certain types of images:
695 *
696 * ```ts
697 * // Allow only JPEG and PNG images:
698 * const imageUploadConfig = {
699 * types: [ 'png', 'jpeg' ]
700 * };
701 * ```
702 *
703 * The type string should match [one of the sub-types](https://www.iana.org/assignments/media-types/media-types.xhtml#image)
704 * of the image MIME type. For example, for the `image/jpeg` MIME type, add `'jpeg'` to your image upload configuration.
705 *
706 * **Note:** This setting only restricts some image types to be selected and uploaded through the CKEditor UI and commands. Image type
707 * recognition and filtering should also be implemented on the server which accepts image uploads.
708 *
709 * @default [ 'jpeg', 'png', 'gif', 'bmp', 'webp', 'tiff' ]
710 */
711 types: Array<string>;
712}