1 | /**
|
2 | * @license Copyright (c) 2003-2022, 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 | /**
|
7 | * @module image/imageinsert
|
8 | */
|
9 |
|
10 | import { Plugin } from 'ckeditor5/src/core';
|
11 | import ImageUpload from './imageupload';
|
12 | import ImageInsertUI from './imageinsert/imageinsertui';
|
13 |
|
14 | /**
|
15 | * The image insert plugin.
|
16 | *
|
17 | * For a detailed overview, check the {@glink features/images/image-upload/image-upload Image upload feature}
|
18 | * and {@glink features/images/image-upload/images-inserting#inserting-images-via-source-url Insert images via source URL} documentation.
|
19 | *
|
20 | * This plugin does not do anything directly, but it loads a set of specific plugins
|
21 | * to enable image uploading or inserting via implemented integrations:
|
22 | *
|
23 | * * {@link module:image/imageupload~ImageUpload}
|
24 | * * {@link module:image/imageinsert/imageinsertui~ImageInsertUI},
|
25 | *
|
26 | * @extends module:core/plugin~Plugin
|
27 | */
|
28 | export default class ImageInsert extends Plugin {
|
29 | /**
|
30 | * @inheritDoc
|
31 | */
|
32 | static get pluginName() {
|
33 | return 'ImageInsert';
|
34 | }
|
35 |
|
36 | /**
|
37 | * @inheritDoc
|
38 | */
|
39 | static get requires() {
|
40 | return [ ImageUpload, ImageInsertUI ];
|
41 | }
|
42 | }
|
43 |
|
44 | /**
|
45 | * The image insert configuration.
|
46 | *
|
47 | * @member {module:image/imageinsert~ImageInsertConfig} module:image/image~ImageConfig#insert
|
48 | */
|
49 |
|
50 | /**
|
51 | * The configuration of the image insert dropdown panel view. Used by the image insert feature in the `@ckeditor/ckeditor5-image` package.
|
52 | *
|
53 | * ClassicEditor
|
54 | * .create( editorElement, {
|
55 | * image: {
|
56 | * insert: {
|
57 | * ... // settings for "insertImage" view goes here
|
58 | * }
|
59 | * }
|
60 | * } )
|
61 | * .then( ... )
|
62 | * .catch( ... );
|
63 | *
|
64 | * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
65 | *
|
66 | * @interface module:image/imageinsert~ImageInsertConfig
|
67 | */
|
68 |
|
69 | /**
|
70 | * The image insert panel view configuration contains a list of {@link module:image/imageinsert~ImageInsert} integrations.
|
71 | *
|
72 | * The option accepts string tokens.
|
73 | * * for predefined integrations, we have two special strings: `insertImageViaUrl` and `openCKFinder`.
|
74 | * The former adds the **Insert image via URL** feature, while the latter adds the built-in **CKFinder** integration.
|
75 | * * for custom integrations, each string should be a name of the component registered in the
|
76 | * {@link module:ui/componentfactory~ComponentFactory component factory}.
|
77 | * If you have a plugin `PluginX` that registers `pluginXButton` component, then the integration token
|
78 | * in that case should be `pluginXButton`.
|
79 | *
|
80 | * // Add `insertImageViaUrl`, `openCKFinder` and custom `pluginXButton` integrations.
|
81 | * const imageInsertConfig = {
|
82 | * insert: {
|
83 | * integrations: [
|
84 | * 'insertImageViaUrl',
|
85 | * 'openCKFinder',
|
86 | * 'pluginXButton'
|
87 | * ]
|
88 | * }
|
89 | * };
|
90 | *
|
91 | * @protected
|
92 | * @member {Array.<String>} module:image/imageinsert~ImageInsertConfig#integrations
|
93 | * @default [ 'insertImageViaUrl' ]
|
94 | */
|
95 |
|
96 | /**
|
97 | * This options allows to override the image type used by the {@link module:image/image/insertimagecommand~InsertImageCommand} when the user
|
98 | * inserts new images into the editor content. By default, this option is unset which means the editor will choose the optimal image type
|
99 | * based on the context of the insertion (e.g. the current selection and availability of plugins)
|
100 | *
|
101 | * Available options are:
|
102 | *
|
103 | * * `'block'` – all images inserted into the editor will be block (requires the {@link module:image/imageblock~ImageBlock} plugin),
|
104 | * * `'inline'` – all images inserted into the editor will be inline (requires the {@link module:image/imageinline~ImageInline} plugin).
|
105 | *
|
106 | * @member {'inline'|'block'|undefined} module:image/imageinsert~ImageInsertConfig#type
|
107 | */
|