@ckeditor/ckeditor5-easy-image 41.3.1 → 41.4.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.
- package/dist/index-content.css +4 -0
- package/dist/index-editor.css +4 -0
- package/dist/index.css +4 -0
- package/dist/index.js +96 -0
- package/dist/index.js.map +1 -0
- package/dist/types/augmentation.d.ts +15 -0
- package/dist/types/cloudservicesuploadadapter.d.ts +36 -0
- package/dist/types/easyimage.d.ts +51 -0
- package/dist/types/index.d.ts +14 -0
- package/package.json +3 -2
package/dist/index.css
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
import { Plugin } from '@ckeditor/ckeditor5-core/dist/index.js';
|
|
6
|
+
import { logWarning } from '@ckeditor/ckeditor5-utils/dist/index.js';
|
|
7
|
+
import { FileRepository } from '@ckeditor/ckeditor5-upload/dist/index.js';
|
|
8
|
+
|
|
9
|
+
class CloudServicesUploadAdapter extends Plugin {
|
|
10
|
+
/**
|
|
11
|
+
* @inheritDoc
|
|
12
|
+
*/ static get pluginName() {
|
|
13
|
+
return 'CloudServicesUploadAdapter';
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @inheritDoc
|
|
17
|
+
*/ static get requires() {
|
|
18
|
+
return [
|
|
19
|
+
'CloudServices',
|
|
20
|
+
FileRepository
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @inheritDoc
|
|
25
|
+
*/ init() {
|
|
26
|
+
const editor = this.editor;
|
|
27
|
+
const cloudServices = editor.plugins.get('CloudServices');
|
|
28
|
+
const token = cloudServices.token;
|
|
29
|
+
const uploadUrl = cloudServices.uploadUrl;
|
|
30
|
+
if (!token) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const cloudServicesCore = editor.plugins.get('CloudServicesCore');
|
|
34
|
+
this._uploadGateway = cloudServicesCore.createUploadGateway(token, uploadUrl);
|
|
35
|
+
editor.plugins.get(FileRepository).createUploadAdapter = (loader)=>{
|
|
36
|
+
return new Adapter(this._uploadGateway, loader);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
class Adapter {
|
|
41
|
+
upload() {
|
|
42
|
+
return this.loader.file.then((file)=>{
|
|
43
|
+
this.fileUploader = this.uploadGateway.upload(file);
|
|
44
|
+
this.fileUploader.on('progress', (evt, data)=>{
|
|
45
|
+
this.loader.uploadTotal = data.total;
|
|
46
|
+
this.loader.uploaded = data.uploaded;
|
|
47
|
+
});
|
|
48
|
+
return this.fileUploader.send();
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
abort() {
|
|
52
|
+
this.fileUploader.abort();
|
|
53
|
+
}
|
|
54
|
+
constructor(uploadGateway, loader){
|
|
55
|
+
this.uploadGateway = uploadGateway;
|
|
56
|
+
this.loader = loader;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
class EasyImage extends Plugin {
|
|
61
|
+
/**
|
|
62
|
+
* @inheritDoc
|
|
63
|
+
*/ static get pluginName() {
|
|
64
|
+
return 'EasyImage';
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* @inheritDoc
|
|
68
|
+
*/ static get requires() {
|
|
69
|
+
return [
|
|
70
|
+
CloudServicesUploadAdapter,
|
|
71
|
+
'ImageUpload'
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* @inheritDoc
|
|
76
|
+
*/ init() {
|
|
77
|
+
const editor = this.editor;
|
|
78
|
+
if (!editor.plugins.has('ImageBlockEditing') && !editor.plugins.has('ImageInlineEditing')) {
|
|
79
|
+
/**
|
|
80
|
+
* The Easy Image feature requires one of the following plugins to be loaded to work correctly:
|
|
81
|
+
*
|
|
82
|
+
* * {@link module:image/imageblock~ImageBlock},
|
|
83
|
+
* * {@link module:image/imageinline~ImageInline},
|
|
84
|
+
* * {@link module:image/image~Image} (loads both `ImageBlock` and `ImageInline`)
|
|
85
|
+
*
|
|
86
|
+
* Please make sure your editor configuration is correct.
|
|
87
|
+
*
|
|
88
|
+
* @error easy-image-image-feature-missing
|
|
89
|
+
* @param {module:core/editor/editor~Editor} editor
|
|
90
|
+
*/ logWarning('easy-image-image-feature-missing', editor);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export { CloudServicesUploadAdapter, EasyImage };
|
|
96
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.js","../src/cloudservicesuploadadapter.ts","../src/easyimage.ts"],"names":["CloudServicesUploadAdapter","Plugin","pluginName","requires","FileRepository","init","editor","cloudServices","plugins","get","token","uploadUrl","cloudServicesCore","_uploadGateway","createUploadGateway","createUploadAdapter","loader","Adapter","upload","file","then","fileUploader","uploadGateway","on","evt","data","uploadTotal","total","uploaded","send","abort","constructor","EasyImage","has","logWarning"],"mappings":";;;;AAAA,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAChE,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACrE,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,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AC,CAAC,SAAS,CAAC,CAAC,CAAC;AACjD,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG","file":"index.js.map","sourcesContent":["import { Plugin } from '@ckeditor/ckeditor5-core/dist/index.js';\nimport { logWarning } from '@ckeditor/ckeditor5-utils/dist/index.js';\nimport { FileRepository } from '@ckeditor/ckeditor5-upload/dist/index.js';\n\nclass CloudServicesUploadAdapter extends Plugin {\n /**\n * @inheritDoc\n */ static get pluginName() {\n return 'CloudServicesUploadAdapter';\n }\n /**\n * @inheritDoc\n */ static get requires() {\n return [\n 'CloudServices',\n FileRepository\n ];\n }\n /**\n * @inheritDoc\n */ init() {\n const editor = this.editor;\n const cloudServices = editor.plugins.get('CloudServices');\n const token = cloudServices.token;\n const uploadUrl = cloudServices.uploadUrl;\n if (!token) {\n return;\n }\n const cloudServicesCore = editor.plugins.get('CloudServicesCore');\n this._uploadGateway = cloudServicesCore.createUploadGateway(token, uploadUrl);\n editor.plugins.get(FileRepository).createUploadAdapter = (loader)=>{\n return new Adapter(this._uploadGateway, loader);\n };\n }\n}\nclass Adapter {\n upload() {\n return this.loader.file.then((file)=>{\n this.fileUploader = this.uploadGateway.upload(file);\n this.fileUploader.on('progress', (evt, data)=>{\n this.loader.uploadTotal = data.total;\n this.loader.uploaded = data.uploaded;\n });\n return this.fileUploader.send();\n });\n }\n abort() {\n this.fileUploader.abort();\n }\n constructor(uploadGateway, loader){\n this.uploadGateway = uploadGateway;\n this.loader = loader;\n }\n}\n\nclass EasyImage extends Plugin {\n /**\n * @inheritDoc\n */ static get pluginName() {\n return 'EasyImage';\n }\n /**\n * @inheritDoc\n */ static get requires() {\n return [\n CloudServicesUploadAdapter,\n 'ImageUpload'\n ];\n }\n /**\n * @inheritDoc\n */ init() {\n const editor = this.editor;\n if (!editor.plugins.has('ImageBlockEditing') && !editor.plugins.has('ImageInlineEditing')) {\n /**\n * The Easy Image feature requires one of the following plugins to be loaded to work correctly:\n *\n * * {@link module:image/imageblock~ImageBlock},\n * * {@link module:image/imageinline~ImageInline},\n * * {@link module:image/image~Image} (loads both `ImageBlock` and `ImageInline`)\n *\n * Please make sure your editor configuration is correct.\n *\n * @error easy-image-image-feature-missing\n * @param {module:core/editor/editor~Editor} editor\n */ logWarning('easy-image-image-feature-missing', editor);\n }\n }\n}\n\nexport { CloudServicesUploadAdapter, EasyImage };\n//# sourceMappingURL=index.js.map\n","/**\n * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n* @module easy-image/cloudservicesuploadadapter\n*/\n\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { FileRepository, type FileLoader, type UploadAdapter } from 'ckeditor5/src/upload.js';\nimport type { CloudServicesCore, CloudServices, UploadGateway, FileUploader } from '@ckeditor/ckeditor5-cloud-services';\n\n/**\n * A plugin that enables upload to [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/).\n *\n * It is mainly used by the {@link module:easy-image/easyimage~EasyImage} feature.\n *\n * After enabling this adapter you need to configure the CKEditor Cloud Services integration through\n * {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudServices`}.\n */\nexport default class CloudServicesUploadAdapter extends Plugin {\n\tprivate _uploadGateway?: UploadGateway;\n\n\t/**\n\t * @inheritDoc\n\t */\n\tpublic static get pluginName() {\n\t\treturn 'CloudServicesUploadAdapter' as const;\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tpublic static get requires() {\n\t\treturn [ 'CloudServices', FileRepository ] as const;\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tpublic init(): void {\n\t\tconst editor = this.editor;\n\n\t\tconst cloudServices: CloudServices = editor.plugins.get( 'CloudServices' );\n\n\t\tconst token = cloudServices.token;\n\t\tconst uploadUrl = cloudServices.uploadUrl;\n\n\t\tif ( !token ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst cloudServicesCore: CloudServicesCore = editor.plugins.get( 'CloudServicesCore' );\n\t\tthis._uploadGateway = cloudServicesCore.createUploadGateway( token, uploadUrl! );\n\n\t\teditor.plugins.get( FileRepository ).createUploadAdapter = loader => {\n\t\t\treturn new Adapter( this._uploadGateway!, loader );\n\t\t};\n\t}\n}\n\nclass Adapter implements UploadAdapter {\n\tprivate uploadGateway: UploadGateway;\n\tprivate loader: FileLoader;\n\tprivate fileUploader?: FileUploader;\n\n\tconstructor( uploadGateway: UploadGateway, loader: FileLoader ) {\n\t\tthis.uploadGateway = uploadGateway;\n\n\t\tthis.loader = loader;\n\t}\n\n\tpublic upload() {\n\t\treturn this.loader.file.then( file => {\n\t\t\tthis.fileUploader = this.uploadGateway.upload( file! );\n\n\t\t\tthis.fileUploader.on( 'progress', ( evt, data ) => {\n\t\t\t\tthis.loader.uploadTotal = data.total;\n\t\t\t\tthis.loader.uploaded = data.uploaded;\n\t\t\t} );\n\n\t\t\treturn this.fileUploader.send();\n\t\t} );\n\t}\n\n\tpublic abort() {\n\t\tthis.fileUploader!.abort();\n\t}\n}\n","/**\n * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module easy-image/easyimage\n */\n\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { logWarning } from 'ckeditor5/src/utils.js';\n\nimport CloudServicesUploadAdapter from './cloudservicesuploadadapter.js';\n\n/**\n * The Easy Image feature, which makes the image upload in CKEditor 5 possible with virtually zero\n * server setup. A part of the [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)\n * family.\n *\n * This is a \"glue\" plugin which enables:\n *\n * * {@link module:easy-image/cloudservicesuploadadapter~CloudServicesUploadAdapter}.\n *\n * This plugin requires plugin to be present in the editor configuration:\n *\n * * {@link module:image/image~Image},\n * * {@link module:image/imageupload~ImageUpload},\n *\n * See the {@glink features/images/image-upload/easy-image \"Easy Image integration\" guide} to learn how to configure\n * and use this feature.\n *\n * Check out the {@glink features/images/image-upload/image-upload comprehensive \"Image upload\" guide} to learn about\n * other ways to upload images into CKEditor 5.\n *\n * **Note**: After enabling the Easy Image plugin you need to configure the\n * [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)\n * integration through {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudServices`}.\n */\nexport default class EasyImage extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tpublic static get pluginName() {\n\t\treturn 'EasyImage' as const;\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tpublic static get requires() {\n\t\treturn [ CloudServicesUploadAdapter, 'ImageUpload' ] as const;\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tpublic init(): void {\n\t\tconst editor = this.editor;\n\n\t\tif ( !editor.plugins.has( 'ImageBlockEditing' ) && !editor.plugins.has( 'ImageInlineEditing' ) ) {\n\t\t\t/**\n\t\t\t * The Easy Image feature requires one of the following plugins to be loaded to work correctly:\n\t\t\t *\n\t\t\t * * {@link module:image/imageblock~ImageBlock},\n\t\t\t * * {@link module:image/imageinline~ImageInline},\n\t\t\t * * {@link module:image/image~Image} (loads both `ImageBlock` and `ImageInline`)\n\t\t\t *\n\t\t\t * Please make sure your editor configuration is correct.\n\t\t\t *\n\t\t\t * @error easy-image-image-feature-missing\n\t\t\t * @param {module:core/editor/editor~Editor} editor\n\t\t\t */\n\t\t\tlogWarning( 'easy-image-image-feature-missing', editor );\n\t\t}\n\t}\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
+
*/
|
|
9
|
+
import type { EasyImage, CloudServicesUploadAdapter } from './index.js';
|
|
10
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
11
|
+
interface PluginsMap {
|
|
12
|
+
[EasyImage.pluginName]: EasyImage;
|
|
13
|
+
[CloudServicesUploadAdapter.pluginName]: CloudServicesUploadAdapter;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @module easy-image/cloudservicesuploadadapter
|
|
11
|
+
*/
|
|
12
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
13
|
+
import { FileRepository } from 'ckeditor5/src/upload.js';
|
|
14
|
+
/**
|
|
15
|
+
* A plugin that enables upload to [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/).
|
|
16
|
+
*
|
|
17
|
+
* It is mainly used by the {@link module:easy-image/easyimage~EasyImage} feature.
|
|
18
|
+
*
|
|
19
|
+
* After enabling this adapter you need to configure the CKEditor Cloud Services integration through
|
|
20
|
+
* {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudServices`}.
|
|
21
|
+
*/
|
|
22
|
+
export default class CloudServicesUploadAdapter extends Plugin {
|
|
23
|
+
private _uploadGateway?;
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
static get pluginName(): "CloudServicesUploadAdapter";
|
|
28
|
+
/**
|
|
29
|
+
* @inheritDoc
|
|
30
|
+
*/
|
|
31
|
+
static get requires(): readonly ["CloudServices", typeof FileRepository];
|
|
32
|
+
/**
|
|
33
|
+
* @inheritDoc
|
|
34
|
+
*/
|
|
35
|
+
init(): void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @module easy-image/easyimage
|
|
11
|
+
*/
|
|
12
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
13
|
+
import CloudServicesUploadAdapter from './cloudservicesuploadadapter.js';
|
|
14
|
+
/**
|
|
15
|
+
* The Easy Image feature, which makes the image upload in CKEditor 5 possible with virtually zero
|
|
16
|
+
* server setup. A part of the [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)
|
|
17
|
+
* family.
|
|
18
|
+
*
|
|
19
|
+
* This is a "glue" plugin which enables:
|
|
20
|
+
*
|
|
21
|
+
* * {@link module:easy-image/cloudservicesuploadadapter~CloudServicesUploadAdapter}.
|
|
22
|
+
*
|
|
23
|
+
* This plugin requires plugin to be present in the editor configuration:
|
|
24
|
+
*
|
|
25
|
+
* * {@link module:image/image~Image},
|
|
26
|
+
* * {@link module:image/imageupload~ImageUpload},
|
|
27
|
+
*
|
|
28
|
+
* See the {@glink features/images/image-upload/easy-image "Easy Image integration" guide} to learn how to configure
|
|
29
|
+
* and use this feature.
|
|
30
|
+
*
|
|
31
|
+
* Check out the {@glink features/images/image-upload/image-upload comprehensive "Image upload" guide} to learn about
|
|
32
|
+
* other ways to upload images into CKEditor 5.
|
|
33
|
+
*
|
|
34
|
+
* **Note**: After enabling the Easy Image plugin you need to configure the
|
|
35
|
+
* [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)
|
|
36
|
+
* integration through {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudServices`}.
|
|
37
|
+
*/
|
|
38
|
+
export default class EasyImage extends Plugin {
|
|
39
|
+
/**
|
|
40
|
+
* @inheritDoc
|
|
41
|
+
*/
|
|
42
|
+
static get pluginName(): "EasyImage";
|
|
43
|
+
/**
|
|
44
|
+
* @inheritDoc
|
|
45
|
+
*/
|
|
46
|
+
static get requires(): readonly [typeof CloudServicesUploadAdapter, "ImageUpload"];
|
|
47
|
+
/**
|
|
48
|
+
* @inheritDoc
|
|
49
|
+
*/
|
|
50
|
+
init(): void;
|
|
51
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @module easy-image
|
|
11
|
+
*/
|
|
12
|
+
export { default as EasyImage } from './easyimage.js';
|
|
13
|
+
export { default as CloudServicesUploadAdapter } from './cloudservicesuploadadapter.js';
|
|
14
|
+
import './augmentation.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-easy-image",
|
|
3
|
-
"version": "41.
|
|
3
|
+
"version": "41.4.0",
|
|
4
4
|
"description": "Easy Image feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "src/index.js",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"ckeditor5": "41.
|
|
16
|
+
"ckeditor5": "41.4.0"
|
|
17
17
|
},
|
|
18
18
|
"author": "CKSource (http://cksource.com/)",
|
|
19
19
|
"license": "GPL-2.0-or-later",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"directory": "packages/ckeditor5-easy-image"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
|
+
"dist",
|
|
28
29
|
"lang",
|
|
29
30
|
"src/**/*.js",
|
|
30
31
|
"src/**/*.d.ts",
|