@ckeditor/ckeditor5-easy-image 36.0.1 → 37.0.0-alpha.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.
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md.
4
- */(()=>{var e={704:(e,t,r)=>{e.exports=r(79)("./src/core.js")},448:(e,t,r)=>{e.exports=r(79)("./src/upload.js")},209:(e,t,r)=>{e.exports=r(79)("./src/utils.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function r(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},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 o={};(()=>{"use strict";r.r(o),r.d(o,{CloudServicesUploadAdapter:()=>i,EasyImage:()=>l});var e=r(704),t=r(209),a=r(448);class i extends e.Plugin{static get pluginName(){return"CloudServicesUploadAdapter"}static get requires(){return["CloudServices",a.FileRepository]}init(){const e=this.editor,t=e.plugins.get("CloudServices"),r=t.token,o=t.uploadUrl;r&&(this._uploadGateway=e.plugins.get("CloudServicesCore").createUploadGateway(r,o),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 requires(){return[i,"ImageUpload"]}init(){const e=this.editor;e.plugins.has("ImageBlockEditing")||e.plugins.has("ImageInlineEditing")||(0,t.logWarning)("easy-image-image-feature-missing",e)}static get pluginName(){return"EasyImage"}}})(),(window.CKEditor5=window.CKEditor5||{}).easyImage=o})();
4
+ */(()=>{var e={704:(e,t,r)=>{e.exports=r(79)("./src/core.js")},448:(e,t,r)=>{e.exports=r(79)("./src/upload.js")},209:(e,t,r)=>{e.exports=r(79)("./src/utils.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function r(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},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 o={};(()=>{"use strict";r.r(o),r.d(o,{CloudServicesUploadAdapter:()=>i,EasyImage:()=>l});var e=r(704),t=r(209),a=r(448);class i extends e.Plugin{static get pluginName(){return"CloudServicesUploadAdapter"}static get requires(){return["CloudServices",a.FileRepository]}init(){const e=this.editor,t=e.plugins.get("CloudServices"),r=t.token,o=t.uploadUrl;if(!r)return;const i=e.plugins.get("CloudServicesCore");this._uploadGateway=i.createUploadGateway(r,o),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 requires(){return[i,"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=o})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-easy-image",
3
- "version": "36.0.1",
3
+ "version": "37.0.0-alpha.0",
4
4
  "description": "Easy Image feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -12,19 +12,20 @@
12
12
  ],
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "ckeditor5": "^36.0.1"
15
+ "ckeditor5": "^37.0.0-alpha.0"
16
16
  },
17
17
  "devDependencies": {
18
- "@ckeditor/ckeditor5-clipboard": "^36.0.1",
19
- "@ckeditor/ckeditor5-cloud-services": "^36.0.1",
20
- "@ckeditor/ckeditor5-core": "^36.0.1",
21
- "@ckeditor/ckeditor5-dev-utils": "^32.0.0",
22
- "@ckeditor/ckeditor5-editor-classic": "^36.0.1",
23
- "@ckeditor/ckeditor5-image": "^36.0.1",
24
- "@ckeditor/ckeditor5-paragraph": "^36.0.1",
25
- "@ckeditor/ckeditor5-theme-lark": "^36.0.1",
26
- "@ckeditor/ckeditor5-upload": "^36.0.1",
27
- "@ckeditor/ckeditor5-utils": "^36.0.1",
18
+ "@ckeditor/ckeditor5-clipboard": "^37.0.0-alpha.0",
19
+ "@ckeditor/ckeditor5-cloud-services": "^37.0.0-alpha.0",
20
+ "@ckeditor/ckeditor5-core": "^37.0.0-alpha.0",
21
+ "@ckeditor/ckeditor5-dev-utils": "^34.0.0",
22
+ "@ckeditor/ckeditor5-editor-classic": "^37.0.0-alpha.0",
23
+ "@ckeditor/ckeditor5-image": "^37.0.0-alpha.0",
24
+ "@ckeditor/ckeditor5-paragraph": "^37.0.0-alpha.0",
25
+ "@ckeditor/ckeditor5-theme-lark": "^37.0.0-alpha.0",
26
+ "@ckeditor/ckeditor5-upload": "^37.0.0-alpha.0",
27
+ "@ckeditor/ckeditor5-utils": "^37.0.0-alpha.0",
28
+ "typescript": "^4.8.4",
28
29
  "webpack": "^5.58.1",
29
30
  "webpack-cli": "^4.9.0"
30
31
  },
@@ -43,13 +44,17 @@
43
44
  },
44
45
  "files": [
45
46
  "lang",
46
- "src",
47
+ "src/**/*.js",
48
+ "src/**/*.d.ts",
47
49
  "theme",
48
50
  "build",
49
51
  "ckeditor5-metadata.json",
50
52
  "CHANGELOG.md"
51
53
  ],
52
54
  "scripts": {
55
+ "build": "tsc -p ./tsconfig.release.json",
56
+ "postversion": "npm run build",
53
57
  "dll:build": "webpack"
54
- }
58
+ },
59
+ "types": "src/index.d.ts"
55
60
  }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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, type PluginDependencies } from 'ckeditor5/src/core';
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/cloudservices~CloudServicesConfig `config.cloudServices`}.
16
+ */
17
+ export default class CloudServicesUploadAdapter extends Plugin {
18
+ private _uploadGateway?;
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ static get pluginName(): 'CloudServicesUploadAdapter';
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ static get requires(): PluginDependencies;
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ init(): void;
31
+ }
32
+ declare module '@ckeditor/ckeditor5-core' {
33
+ interface PluginsMap {
34
+ [CloudServicesUploadAdapter.pluginName]: CloudServicesUploadAdapter;
35
+ }
36
+ }
@@ -2,14 +2,11 @@
2
2
  * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
-
6
5
  /**
7
6
  * @module easy-image/cloudservicesuploadadapter
8
7
  */
9
-
10
8
  import { Plugin } from 'ckeditor5/src/core';
11
9
  import { FileRepository } from 'ckeditor5/src/upload';
12
-
13
10
  /**
14
11
  * A plugin that enables upload to [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/).
15
12
  *
@@ -17,72 +14,54 @@ import { FileRepository } from 'ckeditor5/src/upload';
17
14
  *
18
15
  * After enabling this adapter you need to configure the CKEditor Cloud Services integration through
19
16
  * {@link module:cloud-services/cloudservices~CloudServicesConfig `config.cloudServices`}.
20
- *
21
- * @extends module:core/plugin~Plugin
22
17
  */
23
18
  export default class CloudServicesUploadAdapter extends Plugin {
24
- /**
25
- * @inheritDoc
26
- */
27
- static get pluginName() {
28
- return 'CloudServicesUploadAdapter';
29
- }
30
-
31
- /**
32
- * @inheritDoc
33
- */
34
- static get requires() {
35
- return [ 'CloudServices', FileRepository ];
36
- }
37
-
38
- /**
39
- * @inheritDoc
40
- */
41
- init() {
42
- const editor = this.editor;
43
-
44
- const cloudServices = editor.plugins.get( 'CloudServices' );
45
-
46
- const token = cloudServices.token;
47
- const uploadUrl = cloudServices.uploadUrl;
48
-
49
- if ( !token ) {
50
- return;
51
- }
52
-
53
- this._uploadGateway = editor.plugins.get( 'CloudServicesCore' ).createUploadGateway( token, uploadUrl );
54
-
55
- editor.plugins.get( FileRepository ).createUploadAdapter = loader => {
56
- return new Adapter( this._uploadGateway, loader );
57
- };
58
- }
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ static get pluginName() {
23
+ return 'CloudServicesUploadAdapter';
24
+ }
25
+ /**
26
+ * @inheritDoc
27
+ */
28
+ static get requires() {
29
+ return ['CloudServices', FileRepository];
30
+ }
31
+ /**
32
+ * @inheritDoc
33
+ */
34
+ init() {
35
+ const editor = this.editor;
36
+ const cloudServices = editor.plugins.get('CloudServices');
37
+ const token = cloudServices.token;
38
+ const uploadUrl = cloudServices.uploadUrl;
39
+ if (!token) {
40
+ return;
41
+ }
42
+ const cloudServicesCore = editor.plugins.get('CloudServicesCore');
43
+ this._uploadGateway = cloudServicesCore.createUploadGateway(token, uploadUrl);
44
+ editor.plugins.get(FileRepository).createUploadAdapter = loader => {
45
+ return new Adapter(this._uploadGateway, loader);
46
+ };
47
+ }
59
48
  }
60
-
61
- /**
62
- * @private
63
- */
64
49
  class Adapter {
65
- constructor( uploadGateway, loader ) {
66
- this.uploadGateway = uploadGateway;
67
-
68
- this.loader = loader;
69
- }
70
-
71
- upload() {
72
- return this.loader.file.then( file => {
73
- this.fileUploader = this.uploadGateway.upload( file );
74
-
75
- this.fileUploader.on( 'progress', ( evt, data ) => {
76
- this.loader.uploadTotal = data.total;
77
- this.loader.uploaded = data.uploaded;
78
- } );
79
-
80
- return this.fileUploader.send();
81
- } );
82
- }
83
-
84
- abort() {
85
- this.fileUploader.abort();
86
- }
50
+ constructor(uploadGateway, loader) {
51
+ this.uploadGateway = uploadGateway;
52
+ this.loader = loader;
53
+ }
54
+ upload() {
55
+ return this.loader.file.then(file => {
56
+ this.fileUploader = this.uploadGateway.upload(file);
57
+ this.fileUploader.on('progress', (evt, data) => {
58
+ this.loader.uploadTotal = data.total;
59
+ this.loader.uploaded = data.uploaded;
60
+ });
61
+ return this.fileUploader.send();
62
+ });
63
+ }
64
+ abort() {
65
+ this.fileUploader?.abort();
66
+ }
87
67
  }
88
-
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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, type PluginDependencies } from 'ckeditor5/src/core';
9
+ /**
10
+ * The Easy Image feature, which makes the image upload in CKEditor 5 possible with virtually zero
11
+ * server setup. A part of the [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)
12
+ * family.
13
+ *
14
+ * This is a "glue" plugin which enables:
15
+ *
16
+ * * {@link module:easy-image/cloudservicesuploadadapter~CloudServicesUploadAdapter}.
17
+ *
18
+ * This plugin requires plugin to be present in the editor configuration:
19
+ *
20
+ * * {@link module:image/image~Image},
21
+ * * {@link module:image/imageupload~ImageUpload},
22
+ *
23
+ * See the {@glink features/images/image-upload/easy-image "Easy Image integration" guide} to learn how to configure
24
+ * and use this feature.
25
+ *
26
+ * Check out the {@glink features/images/image-upload/image-upload comprehensive "Image upload" guide} to learn about
27
+ * other ways to upload images into CKEditor 5.
28
+ *
29
+ * **Note**: After enabling the Easy Image plugin you need to configure the
30
+ * [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)
31
+ * integration through {@link module:cloud-services/cloudservices~CloudServicesConfig `config.cloudServices`}.
32
+ */
33
+ export default class EasyImage extends Plugin {
34
+ /**
35
+ * @inheritDoc
36
+ */
37
+ static get pluginName(): 'EasyImage';
38
+ /**
39
+ * @inheritDoc
40
+ */
41
+ static get requires(): PluginDependencies;
42
+ /**
43
+ * @inheritDoc
44
+ */
45
+ init(): void;
46
+ }
47
+ declare module '@ckeditor/ckeditor5-core' {
48
+ interface PluginsMap {
49
+ [EasyImage.pluginName]: EasyImage;
50
+ }
51
+ }
package/src/easyimage.js CHANGED
@@ -2,16 +2,12 @@
2
2
  * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
-
6
5
  /**
7
6
  * @module easy-image/easyimage
8
7
  */
9
-
10
8
  import { Plugin } from 'ckeditor5/src/core';
11
9
  import { logWarning } from 'ckeditor5/src/utils';
12
-
13
10
  import CloudServicesUploadAdapter from './cloudservicesuploadadapter';
14
-
15
11
  /**
16
12
  * The Easy Image feature, which makes the image upload in CKEditor 5 possible with virtually zero
17
13
  * server setup. A part of the [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)
@@ -35,44 +31,39 @@ import CloudServicesUploadAdapter from './cloudservicesuploadadapter';
35
31
  * **Note**: After enabling the Easy Image plugin you need to configure the
36
32
  * [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)
37
33
  * integration through {@link module:cloud-services/cloudservices~CloudServicesConfig `config.cloudServices`}.
38
- *
39
- * @extends module:core/plugin~Plugin
40
34
  */
41
35
  export default class EasyImage extends Plugin {
42
- /**
43
- * @inheritDoc
44
- */
45
- static get requires() {
46
- return [ CloudServicesUploadAdapter, 'ImageUpload' ];
47
- }
48
-
49
- /**
50
- * @inheritDoc
51
- */
52
- init() {
53
- const editor = this.editor;
54
-
55
- if ( !editor.plugins.has( 'ImageBlockEditing' ) && !editor.plugins.has( 'ImageInlineEditing' ) ) {
56
- /**
57
- * The Easy Image feature requires one of the following plugins to be loaded to work correctly:
58
- *
59
- * * {@link module:image/imageblock~ImageBlock},
60
- * * {@link module:image/imageinline~ImageInline},
61
- * * {@link module:image/image~Image} (loads both `ImageBlock` and `ImageInline`)
62
- *
63
- * Please make sure your editor configuration is correct.
64
- *
65
- * @error easy-image-image-feature-missing
66
- * @param {module:core/editor/editor~Editor} editor
67
- */
68
- logWarning( 'easy-image-image-feature-missing', editor );
69
- }
70
- }
71
-
72
- /**
73
- * @inheritDoc
74
- */
75
- static get pluginName() {
76
- return 'EasyImage';
77
- }
36
+ /**
37
+ * @inheritDoc
38
+ */
39
+ static get pluginName() {
40
+ return 'EasyImage';
41
+ }
42
+ /**
43
+ * @inheritDoc
44
+ */
45
+ static get requires() {
46
+ return [CloudServicesUploadAdapter, 'ImageUpload'];
47
+ }
48
+ /**
49
+ * @inheritDoc
50
+ */
51
+ init() {
52
+ const editor = this.editor;
53
+ if (!editor.plugins.has('ImageBlockEditing') && !editor.plugins.has('ImageInlineEditing')) {
54
+ /**
55
+ * The Easy Image feature requires one of the following plugins to be loaded to work correctly:
56
+ *
57
+ * * {@link module:image/imageblock~ImageBlock},
58
+ * * {@link module:image/imageinline~ImageInline},
59
+ * * {@link module:image/image~Image} (loads both `ImageBlock` and `ImageInline`)
60
+ *
61
+ * Please make sure your editor configuration is correct.
62
+ *
63
+ * @error easy-image-image-feature-missing
64
+ * @param {module:core/editor/editor~Editor} editor
65
+ */
66
+ logWarning('easy-image-image-feature-missing', editor);
67
+ }
68
+ }
78
69
  }
package/src/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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';
9
+ export { default as CloudServicesUploadAdapter } from './cloudservicesuploadadapter';
package/src/index.js CHANGED
@@ -2,10 +2,8 @@
2
2
  * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
-
6
5
  /**
7
6
  * @module easy-image
8
7
  */
9
-
10
8
  export { default as EasyImage } from './easyimage';
11
9
  export { default as CloudServicesUploadAdapter } from './cloudservicesuploadadapter';