@ckeditor/ckeditor5-easy-image 0.0.0-internal-20241017.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/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ Changelog
2
+ =========
3
+
4
+ All changes in the package are documented in https://github.com/ckeditor/ckeditor5/blob/master/CHANGELOG.md.
package/LICENSE.md ADDED
@@ -0,0 +1,17 @@
1
+ Software License Agreement
2
+ ==========================
3
+
4
+ **CKEditor&nbsp;5 Easy Image feature** – https://github.com/ckeditor/ckeditor5-easy-image <br>
5
+ Copyright (c) 2003–2024, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
6
+
7
+ Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
8
+
9
+ Sources of Intellectual Property Included in CKEditor
10
+ -----------------------------------------------------
11
+
12
+ Where not otherwise indicated, all CKEditor content is authored by CKSource engineers and consists of CKSource-owned intellectual property. In some specific instances, CKEditor will incorporate work done by developers outside of CKSource with their express permission.
13
+
14
+ Trademarks
15
+ ----------
16
+
17
+ **CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks, or service marks of their respective holders.
package/README.md ADDED
@@ -0,0 +1,30 @@
1
+ CKEditor&nbsp;5 Easy Image feature with Cloud Services
2
+ =========================================
3
+
4
+ [![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-easy-image.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-easy-image)
5
+ [![Coverage Status](https://coveralls.io/repos/github/ckeditor/ckeditor5/badge.svg?branch=master)](https://coveralls.io/github/ckeditor/ckeditor5?branch=master)
6
+ [![Build Status](https://travis-ci.com/ckeditor/ckeditor5.svg?branch=master)](https://app.travis-ci.com/github/ckeditor/ckeditor5)
7
+
8
+ This package implements the [Easy Image](https://ckeditor.com/docs/ckeditor5/latest/features/easy-image.html) feature for CKEditor&nbsp;5.
9
+
10
+ Easy Image lets you easily insert images which are automatically rescaled, optimized, responsive and delivered through a blazing-fast CDN. It integrates automatically with the [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/).
11
+
12
+ ## Demo
13
+
14
+ Check out the [demo in the Easy Image feature guide](https://ckeditor.com/docs/ckeditor5/latest/features/images/image-upload/easy-image.html#demo).
15
+
16
+ ## Documentation
17
+
18
+ See the [Easy Image integration](https://ckeditor.com/docs/ckeditor5/latest/features/images/image-upload/easy-image.html) guide and the [plugin documentation](https://ckeditor.com/docs/ckeditor5/latest/api/easy-image.html) to learn how to enable the integration.
19
+
20
+ Check out the comprehensive [image upload](https://ckeditor.com/docs/ckeditor5/latest/features/images/image-upload/image-upload.html) guide to learn about other ways to upload images into CKEditor&nbsp;5.
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ npm install ckeditor5
26
+ ```
27
+
28
+ ## License
29
+
30
+ Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html). For full details about the license, please check the `LICENSE.md` file or [https://ckeditor.com/legal/ckeditor-oss-license](https://ckeditor.com/legal/ckeditor-oss-license).
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */(()=>{var e={782:(e,t,r)=>{e.exports=r(237)("./src/core.js")},260:(e,t,r)=>{e.exports=r(237)("./src/upload.js")},584:(e,t,r)=>{e.exports=r(237)("./src/utils.js")},237:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function r(i){var a=t[i];if(void 0!==a)return a.exports;var o=t[i]={exports:{}};return e[i](o,o.exports,r),o.exports}r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};(()=>{"use strict";r.r(i),r.d(i,{CloudServicesUploadAdapter:()=>o,EasyImage:()=>l});var e=r(782),t=r(584),a=r(260);class o extends e.Plugin{static get pluginName(){return"CloudServicesUploadAdapter"}static get isOfficialPlugin(){return!0}static get requires(){return["CloudServices",a.FileRepository]}init(){const e=this.editor,t=e.plugins.get("CloudServices"),r=t.token,i=t.uploadUrl;if(!r)return;const o=e.plugins.get("CloudServicesCore");this._uploadGateway=o.createUploadGateway(r,i),e.plugins.get(a.FileRepository).createUploadAdapter=e=>new s(this._uploadGateway,e)}}class s{constructor(e,t){this.uploadGateway=e,this.loader=t}upload(){return this.loader.file.then((e=>(this.fileUploader=this.uploadGateway.upload(e),this.fileUploader.on("progress",((e,t)=>{this.loader.uploadTotal=t.total,this.loader.uploaded=t.uploaded})),this.fileUploader.send())))}abort(){this.fileUploader.abort()}}class l extends e.Plugin{static get pluginName(){return"EasyImage"}static get isOfficialPlugin(){return!0}static get requires(){return[o,"ImageUpload"]}init(){const e=this.editor;e.plugins.has("ImageBlockEditing")||e.plugins.has("ImageInlineEditing")||(0,t.logWarning)("easy-image-image-feature-missing",e)}}})(),(window.CKEditor5=window.CKEditor5||{}).easyImage=i})();
@@ -0,0 +1,18 @@
1
+ {
2
+ "plugins": [
3
+ {
4
+ "name": "Easy Image",
5
+ "className": "EasyImage",
6
+ "description": "An image upload tool with virtually zero server setup. The images are automatically rescaled, optimized, responsive and delivered through a CDN.",
7
+ "path": "src/easyimage.js",
8
+ "requires": [
9
+ "CloudServices",
10
+ [
11
+ "ImageBlock",
12
+ "ImageInline"
13
+ ],
14
+ "ImageUpload"
15
+ ]
16
+ }
17
+ ]
18
+ }
@@ -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,40 @@
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 isOfficialPlugin(): true;
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ static get requires(): readonly ["CloudServices", typeof FileRepository];
36
+ /**
37
+ * @inheritDoc
38
+ */
39
+ init(): void;
40
+ }
@@ -0,0 +1,55 @@
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 [Easy Image Quick Start guide](https://ckeditor.com/docs/cs/latest/guides/easy-image/quick-start.html) 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 isOfficialPlugin(): true;
47
+ /**
48
+ * @inheritDoc
49
+ */
50
+ static get requires(): readonly [typeof CloudServicesUploadAdapter, "ImageUpload"];
51
+ /**
52
+ * @inheritDoc
53
+ */
54
+ init(): void;
55
+ }
@@ -0,0 +1,4 @@
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
+ */
@@ -0,0 +1,4 @@
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
+ */
package/dist/index.css ADDED
@@ -0,0 +1,4 @@
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
+ */
@@ -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/dist/index.js ADDED
@@ -0,0 +1,140 @@
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
+ /**
10
+ * A plugin that enables upload to [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/).
11
+ *
12
+ * It is mainly used by the {@link module:easy-image/easyimage~EasyImage} feature.
13
+ *
14
+ * After enabling this adapter you need to configure the CKEditor Cloud Services integration through
15
+ * {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudServices`}.
16
+ */ class CloudServicesUploadAdapter extends Plugin {
17
+ _uploadGateway;
18
+ /**
19
+ * @inheritDoc
20
+ */ static get pluginName() {
21
+ return 'CloudServicesUploadAdapter';
22
+ }
23
+ /**
24
+ * @inheritDoc
25
+ */ static get isOfficialPlugin() {
26
+ return true;
27
+ }
28
+ /**
29
+ * @inheritDoc
30
+ */ static get requires() {
31
+ return [
32
+ 'CloudServices',
33
+ FileRepository
34
+ ];
35
+ }
36
+ /**
37
+ * @inheritDoc
38
+ */ init() {
39
+ const editor = this.editor;
40
+ const cloudServices = editor.plugins.get('CloudServices');
41
+ const token = cloudServices.token;
42
+ const uploadUrl = cloudServices.uploadUrl;
43
+ if (!token) {
44
+ return;
45
+ }
46
+ const cloudServicesCore = editor.plugins.get('CloudServicesCore');
47
+ this._uploadGateway = cloudServicesCore.createUploadGateway(token, uploadUrl);
48
+ editor.plugins.get(FileRepository).createUploadAdapter = (loader)=>{
49
+ return new Adapter(this._uploadGateway, loader);
50
+ };
51
+ }
52
+ }
53
+ class Adapter {
54
+ uploadGateway;
55
+ loader;
56
+ fileUploader;
57
+ constructor(uploadGateway, loader){
58
+ this.uploadGateway = uploadGateway;
59
+ this.loader = loader;
60
+ }
61
+ upload() {
62
+ return this.loader.file.then((file)=>{
63
+ this.fileUploader = this.uploadGateway.upload(file);
64
+ this.fileUploader.on('progress', (evt, data)=>{
65
+ this.loader.uploadTotal = data.total;
66
+ this.loader.uploaded = data.uploaded;
67
+ });
68
+ return this.fileUploader.send();
69
+ });
70
+ }
71
+ abort() {
72
+ this.fileUploader.abort();
73
+ }
74
+ }
75
+
76
+ /**
77
+ * The Easy Image feature, which makes the image upload in CKEditor 5 possible with virtually zero
78
+ * server setup. A part of the [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)
79
+ * family.
80
+ *
81
+ * This is a "glue" plugin which enables:
82
+ *
83
+ * * {@link module:easy-image/cloudservicesuploadadapter~CloudServicesUploadAdapter}.
84
+ *
85
+ * This plugin requires plugin to be present in the editor configuration:
86
+ *
87
+ * * {@link module:image/image~Image},
88
+ * * {@link module:image/imageupload~ImageUpload},
89
+ *
90
+ * See the [Easy Image Quick Start guide](https://ckeditor.com/docs/cs/latest/guides/easy-image/quick-start.html) to learn how to configure
91
+ * and use this feature.
92
+ *
93
+ * Check out the {@glink features/images/image-upload/image-upload comprehensive "Image upload" guide} to learn about
94
+ * other ways to upload images into CKEditor 5.
95
+ *
96
+ * **Note**: After enabling the Easy Image plugin you need to configure the
97
+ * [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)
98
+ * integration through {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudServices`}.
99
+ */ class EasyImage extends Plugin {
100
+ /**
101
+ * @inheritDoc
102
+ */ static get pluginName() {
103
+ return 'EasyImage';
104
+ }
105
+ /**
106
+ * @inheritDoc
107
+ */ static get isOfficialPlugin() {
108
+ return true;
109
+ }
110
+ /**
111
+ * @inheritDoc
112
+ */ static get requires() {
113
+ return [
114
+ CloudServicesUploadAdapter,
115
+ 'ImageUpload'
116
+ ];
117
+ }
118
+ /**
119
+ * @inheritDoc
120
+ */ init() {
121
+ const editor = this.editor;
122
+ if (!editor.plugins.has('ImageBlockEditing') && !editor.plugins.has('ImageInlineEditing')) {
123
+ /**
124
+ * The Easy Image feature requires one of the following plugins to be loaded to work correctly:
125
+ *
126
+ * * {@link module:image/imageblock~ImageBlock},
127
+ * * {@link module:image/imageinline~ImageInline},
128
+ * * {@link module:image/image~Image} (loads both `ImageBlock` and `ImageInline`)
129
+ *
130
+ * Please make sure your editor configuration is correct.
131
+ *
132
+ * @error easy-image-image-feature-missing
133
+ * @param {module:core/editor/editor~Editor} editor
134
+ */ logWarning('easy-image-image-feature-missing', editor);
135
+ }
136
+ }
137
+ }
138
+
139
+ export { CloudServicesUploadAdapter, EasyImage };
140
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.js","../src/cloudservicesuploadadapter.ts","../src/easyimage.ts"],"names":["CloudServicesUploadAdapter","Plugin","_uploadGateway","pluginName","isOfficialPlugin","requires","FileRepository","editor","cloudServices","plugins","get","token","uploadUrl","cloudServicesCore","createUploadGateway","createUploadAdapter","loader","Adapter","uploadGateway","fileUploader","constructor","upload","file","then","on","evt","data","uploadTotal","total","uploaded","send","abort","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;AAC/D,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;AACpE,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;;ACWzE,CAAA,CAAA;ADRA,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAC3G,CAAC;AACD,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,MAA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ditor5-utils/dist/index.js';\nimport { FileRepository } from '@ckeditor/ckeditor5-upload/dist/index.js';\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 */ class CloudServicesUploadAdapter extends Plugin {\n _uploadGateway;\n /**\n\t * @inheritDoc\n\t */ static get pluginName() {\n return 'CloudServicesUploadAdapter';\n }\n /**\n\t * @inheritDoc\n\t */ static get isOfficialPlugin() {\n return true;\n }\n /**\n\t * @inheritDoc\n\t */ static get requires() {\n return [\n 'CloudServices',\n FileRepository\n ];\n }\n /**\n\t * @inheritDoc\n\t */ 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 uploadGateway;\n loader;\n fileUploader;\n constructor(uploadGateway, loader){\n this.uploadGateway = uploadGateway;\n this.loader = loader;\n }\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}\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 [Easy Image Quick Start guide](https://ckeditor.com/docs/cs/latest/guides/easy-image/quick-start.html) 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 */ class EasyImage extends Plugin {\n /**\n\t * @inheritDoc\n\t */ static get pluginName() {\n return 'EasyImage';\n }\n /**\n\t * @inheritDoc\n\t */ static get isOfficialPlugin() {\n return true;\n }\n /**\n\t * @inheritDoc\n\t */ static get requires() {\n return [\n CloudServicesUploadAdapter,\n 'ImageUpload'\n ];\n }\n /**\n\t * @inheritDoc\n\t */ init() {\n const editor = this.editor;\n if (!editor.plugins.has('ImageBlockEditing') && !editor.plugins.has('ImageInlineEditing')) {\n /**\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 */ 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 override get isOfficialPlugin(): true {\n\t\treturn true;\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 [Easy Image Quick Start guide](https://ckeditor.com/docs/cs/latest/guides/easy-image/quick-start.html) 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 override get isOfficialPlugin(): true {\n\t\treturn true;\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"]}
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@ckeditor/ckeditor5-easy-image",
3
+ "version": "0.0.0-internal-20241017.0",
4
+ "description": "Easy Image feature for CKEditor 5.",
5
+ "keywords": [
6
+ "ckeditor",
7
+ "ckeditor5",
8
+ "ckeditor 5",
9
+ "ckeditor5-feature",
10
+ "ckeditor5-plugin",
11
+ "ckeditor5-dll"
12
+ ],
13
+ "type": "module",
14
+ "main": "src/index.js",
15
+ "dependencies": {
16
+ "@ckeditor/ckeditor5-core": "0.0.0-internal-20241017.0",
17
+ "@ckeditor/ckeditor5-upload": "0.0.0-internal-20241017.0",
18
+ "@ckeditor/ckeditor5-utils": "0.0.0-internal-20241017.0",
19
+ "ckeditor5": "0.0.0-internal-20241017.0"
20
+ },
21
+ "author": "CKSource (http://cksource.com/)",
22
+ "license": "GPL-2.0-or-later",
23
+ "homepage": "https://ckeditor.com/ckeditor-5",
24
+ "bugs": "https://github.com/ckeditor/ckeditor5/issues",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://github.com/ckeditor/ckeditor5.git",
28
+ "directory": "packages/ckeditor5-easy-image"
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "lang",
33
+ "src/**/*.js",
34
+ "src/**/*.d.ts",
35
+ "theme",
36
+ "build",
37
+ "ckeditor5-metadata.json",
38
+ "CHANGELOG.md"
39
+ ],
40
+ "types": "src/index.d.ts"
41
+ }
@@ -0,0 +1,11 @@
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 type { EasyImage, CloudServicesUploadAdapter } from './index.js';
6
+ declare module '@ckeditor/ckeditor5-core' {
7
+ interface PluginsMap {
8
+ [EasyImage.pluginName]: EasyImage;
9
+ [CloudServicesUploadAdapter.pluginName]: CloudServicesUploadAdapter;
10
+ }
11
+ }
@@ -0,0 +1,5 @@
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
+ export {};
@@ -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
+ * @module easy-image/cloudservicesuploadadapter
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { FileRepository } from 'ckeditor5/src/upload.js';
10
+ /**
11
+ * A plugin that enables upload to [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/).
12
+ *
13
+ * It is mainly used by the {@link module:easy-image/easyimage~EasyImage} feature.
14
+ *
15
+ * After enabling this adapter you need to configure the CKEditor Cloud Services integration through
16
+ * {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudServices`}.
17
+ */
18
+ export default class CloudServicesUploadAdapter extends Plugin {
19
+ private _uploadGateway?;
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get pluginName(): "CloudServicesUploadAdapter";
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ static get isOfficialPlugin(): true;
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ static get requires(): readonly ["CloudServices", typeof FileRepository];
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ init(): void;
36
+ }
@@ -0,0 +1,73 @@
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 easy-image/cloudservicesuploadadapter
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { FileRepository } from 'ckeditor5/src/upload.js';
10
+ /**
11
+ * A plugin that enables upload to [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/).
12
+ *
13
+ * It is mainly used by the {@link module:easy-image/easyimage~EasyImage} feature.
14
+ *
15
+ * After enabling this adapter you need to configure the CKEditor Cloud Services integration through
16
+ * {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudServices`}.
17
+ */
18
+ export default class CloudServicesUploadAdapter extends Plugin {
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ static get pluginName() {
23
+ return 'CloudServicesUploadAdapter';
24
+ }
25
+ /**
26
+ * @inheritDoc
27
+ */
28
+ static get isOfficialPlugin() {
29
+ return true;
30
+ }
31
+ /**
32
+ * @inheritDoc
33
+ */
34
+ static get requires() {
35
+ return ['CloudServices', FileRepository];
36
+ }
37
+ /**
38
+ * @inheritDoc
39
+ */
40
+ init() {
41
+ const editor = this.editor;
42
+ const cloudServices = editor.plugins.get('CloudServices');
43
+ const token = cloudServices.token;
44
+ const uploadUrl = cloudServices.uploadUrl;
45
+ if (!token) {
46
+ return;
47
+ }
48
+ const cloudServicesCore = editor.plugins.get('CloudServicesCore');
49
+ this._uploadGateway = cloudServicesCore.createUploadGateway(token, uploadUrl);
50
+ editor.plugins.get(FileRepository).createUploadAdapter = loader => {
51
+ return new Adapter(this._uploadGateway, loader);
52
+ };
53
+ }
54
+ }
55
+ class Adapter {
56
+ constructor(uploadGateway, loader) {
57
+ this.uploadGateway = uploadGateway;
58
+ this.loader = loader;
59
+ }
60
+ upload() {
61
+ return this.loader.file.then(file => {
62
+ this.fileUploader = this.uploadGateway.upload(file);
63
+ this.fileUploader.on('progress', (evt, data) => {
64
+ this.loader.uploadTotal = data.total;
65
+ this.loader.uploaded = data.uploaded;
66
+ });
67
+ return this.fileUploader.send();
68
+ });
69
+ }
70
+ abort() {
71
+ this.fileUploader.abort();
72
+ }
73
+ }
@@ -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
+ * @module easy-image/easyimage
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import CloudServicesUploadAdapter from './cloudservicesuploadadapter.js';
10
+ /**
11
+ * The Easy Image feature, which makes the image upload in CKEditor 5 possible with virtually zero
12
+ * server setup. A part of the [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)
13
+ * family.
14
+ *
15
+ * This is a "glue" plugin which enables:
16
+ *
17
+ * * {@link module:easy-image/cloudservicesuploadadapter~CloudServicesUploadAdapter}.
18
+ *
19
+ * This plugin requires plugin to be present in the editor configuration:
20
+ *
21
+ * * {@link module:image/image~Image},
22
+ * * {@link module:image/imageupload~ImageUpload},
23
+ *
24
+ * See the [Easy Image Quick Start guide](https://ckeditor.com/docs/cs/latest/guides/easy-image/quick-start.html) to learn how to configure
25
+ * and use this feature.
26
+ *
27
+ * Check out the {@glink features/images/image-upload/image-upload comprehensive "Image upload" guide} to learn about
28
+ * other ways to upload images into CKEditor 5.
29
+ *
30
+ * **Note**: After enabling the Easy Image plugin you need to configure the
31
+ * [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)
32
+ * integration through {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudServices`}.
33
+ */
34
+ export default class EasyImage extends Plugin {
35
+ /**
36
+ * @inheritDoc
37
+ */
38
+ static get pluginName(): "EasyImage";
39
+ /**
40
+ * @inheritDoc
41
+ */
42
+ static get isOfficialPlugin(): true;
43
+ /**
44
+ * @inheritDoc
45
+ */
46
+ static get requires(): readonly [typeof CloudServicesUploadAdapter, "ImageUpload"];
47
+ /**
48
+ * @inheritDoc
49
+ */
50
+ init(): void;
51
+ }
@@ -0,0 +1,75 @@
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 easy-image/easyimage
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { logWarning } from 'ckeditor5/src/utils.js';
10
+ import CloudServicesUploadAdapter from './cloudservicesuploadadapter.js';
11
+ /**
12
+ * The Easy Image feature, which makes the image upload in CKEditor 5 possible with virtually zero
13
+ * server setup. A part of the [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)
14
+ * family.
15
+ *
16
+ * This is a "glue" plugin which enables:
17
+ *
18
+ * * {@link module:easy-image/cloudservicesuploadadapter~CloudServicesUploadAdapter}.
19
+ *
20
+ * This plugin requires plugin to be present in the editor configuration:
21
+ *
22
+ * * {@link module:image/image~Image},
23
+ * * {@link module:image/imageupload~ImageUpload},
24
+ *
25
+ * See the [Easy Image Quick Start guide](https://ckeditor.com/docs/cs/latest/guides/easy-image/quick-start.html) to learn how to configure
26
+ * and use this feature.
27
+ *
28
+ * Check out the {@glink features/images/image-upload/image-upload comprehensive "Image upload" guide} to learn about
29
+ * other ways to upload images into CKEditor 5.
30
+ *
31
+ * **Note**: After enabling the Easy Image plugin you need to configure the
32
+ * [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)
33
+ * integration through {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudServices`}.
34
+ */
35
+ export default class EasyImage extends Plugin {
36
+ /**
37
+ * @inheritDoc
38
+ */
39
+ static get pluginName() {
40
+ return 'EasyImage';
41
+ }
42
+ /**
43
+ * @inheritDoc
44
+ */
45
+ static get isOfficialPlugin() {
46
+ return true;
47
+ }
48
+ /**
49
+ * @inheritDoc
50
+ */
51
+ static get requires() {
52
+ return [CloudServicesUploadAdapter, 'ImageUpload'];
53
+ }
54
+ /**
55
+ * @inheritDoc
56
+ */
57
+ init() {
58
+ const editor = this.editor;
59
+ if (!editor.plugins.has('ImageBlockEditing') && !editor.plugins.has('ImageInlineEditing')) {
60
+ /**
61
+ * The Easy Image feature requires one of the following plugins to be loaded to work correctly:
62
+ *
63
+ * * {@link module:image/imageblock~ImageBlock},
64
+ * * {@link module:image/imageinline~ImageInline},
65
+ * * {@link module:image/image~Image} (loads both `ImageBlock` and `ImageInline`)
66
+ *
67
+ * Please make sure your editor configuration is correct.
68
+ *
69
+ * @error easy-image-image-feature-missing
70
+ * @param {module:core/editor/editor~Editor} editor
71
+ */
72
+ logWarning('easy-image-image-feature-missing', editor);
73
+ }
74
+ }
75
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,10 @@
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 easy-image
7
+ */
8
+ export { default as EasyImage } from './easyimage.js';
9
+ export { default as CloudServicesUploadAdapter } from './cloudservicesuploadadapter.js';
10
+ import './augmentation.js';
package/src/index.js ADDED
@@ -0,0 +1,10 @@
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 easy-image
7
+ */
8
+ export { default as EasyImage } from './easyimage.js';
9
+ export { default as CloudServicesUploadAdapter } from './cloudservicesuploadadapter.js';
10
+ import './augmentation.js';