1 | import { Plugin } from '@ckeditor/ckeditor5-core';
|
2 | import ImageInsertUI from './imageinsert/imageinsertui';
|
3 | import ImageUpload from './imageupload';
|
4 |
|
5 | /**
|
6 | * The image insert plugin.
|
7 | *
|
8 | * For a detailed overview, check the {@glink features/images/image-upload/image-upload Image upload feature}
|
9 | * and {@glink features/images/image-upload/images-inserting#inserting-images-via-source-url Insert images via source URL} documentation.
|
10 | *
|
11 | * This plugin does not do anything directly, but it loads a set of specific plugins
|
12 | * to enable image uploading or inserting via implemented integrations:
|
13 | *
|
14 | * * {@link module:image/imageupload~ImageUpload}
|
15 | * * {@link module:image/imageinsert/imageinsertui~ImageInsertUI},
|
16 | */
|
17 | export default class ImageInsert extends Plugin {
|
18 | static readonly pluginName: 'ImageInsert';
|
19 | static readonly requires: [typeof ImageUpload, typeof ImageInsertUI];
|
20 | }
|
21 |
|
22 | export interface ImageInsertConfig {
|
23 | /**
|
24 | * This options allows to override the image type used by the {@link module:image/image/insertimagecommand~InsertImageCommand} when the user
|
25 | * inserts new images into the editor content. By default, this option is unset which means the editor will choose the optimal image type
|
26 | * based on the context of the insertion (e.g. the current selection and availability of plugins)
|
27 | *
|
28 | * Available options are:
|
29 | *
|
30 | * * `'block'` – all images inserted into the editor will be block (requires the {@link module:image/imageblock~ImageBlock} plugin),
|
31 | * * `'inline'` – all images inserted into the editor will be inline (requires the {@link module:image/imageinline~ImageInline} plugin).
|
32 | */
|
33 | type?: 'inline' | 'block' | undefined;
|
34 | /**
|
35 | * The image insert panel view configuration contains a list of {@link module:image/imageinsert~ImageInsert} integrations.
|
36 | *
|
37 | * The option accepts string tokens.
|
38 | * * for predefined integrations, we have two special strings: `insertImageViaUrl` and `openCKFinder`.
|
39 | * The former adds the **Insert image via URL** feature, while the latter adds the built-in **CKFinder** integration.
|
40 | * * for custom integrations, each string should be a name of the component registered in the
|
41 | * {@link module:ui/componentfactory~ComponentFactory component factory}.
|
42 | * If you have a plugin `PluginX` that registers `pluginXButton` component, then the integration token
|
43 | * in that case should be `pluginXButton`.
|
44 | *
|
45 | * // Add `insertImageViaUrl`, `openCKFinder` and custom `pluginXButton` integrations.
|
46 | * const imageInsertConfig = {
|
47 | * insert: {
|
48 | * integrations: [
|
49 | * 'insertImageViaUrl',
|
50 | * 'openCKFinder',
|
51 | * 'pluginXButton'
|
52 | * ]
|
53 | * }
|
54 | * };
|
55 | */
|
56 | integrations?: string[];
|
57 | }
|
58 |
|
59 | declare module '@ckeditor/ckeditor5-core/src/plugincollection' {
|
60 | interface Plugins {
|
61 | ImageInsert: ImageInsert;
|
62 | }
|
63 | }
|