@ckeditor/ckeditor5-easy-image 40.0.0 → 40.2.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 +21 -21
- package/LICENSE.md +2 -2
- package/package.json +2 -2
- package/src/augmentation.d.ts +11 -11
- package/src/augmentation.js +5 -5
- package/src/cloudservicesuploadadapter.d.ts +32 -32
- package/src/cloudservicesuploadadapter.js +67 -67
- package/src/easyimage.d.ts +47 -47
- package/src/easyimage.js +69 -69
- package/src/index.d.ts +10 -10
- package/src/index.js +10 -10
- package/build/easy-image.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,86 +5,86 @@ All changes in the package are documented in the main repository. See: https://g
|
|
|
5
5
|
|
|
6
6
|
Changes for the past releases are available below.
|
|
7
7
|
|
|
8
|
-
## [19.0.0](https://github.com/ckeditor/ckeditor5-easy-image/compare/v18.0.0...v19.0.0) (2020
|
|
8
|
+
## [19.0.0](https://github.com/ckeditor/ckeditor5-easy-image/compare/v18.0.0...v19.0.0) (April 29, 2020)
|
|
9
9
|
|
|
10
10
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
## [18.0.0](https://github.com/ckeditor/ckeditor5-easy-image/compare/v17.0.0...v18.0.0) (2020
|
|
13
|
+
## [18.0.0](https://github.com/ckeditor/ckeditor5-easy-image/compare/v17.0.0...v18.0.0) (March 19, 2020)
|
|
14
14
|
|
|
15
15
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
## [17.0.0](https://github.com/ckeditor/ckeditor5-easy-image/compare/v16.0.0...v17.0.0) (2020
|
|
18
|
+
## [17.0.0](https://github.com/ckeditor/ckeditor5-easy-image/compare/v16.0.0...v17.0.0) (February 19, 2020)
|
|
19
19
|
|
|
20
20
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
## [16.0.0](https://github.com/ckeditor/ckeditor5-easy-image/compare/v15.0.0...v16.0.0) (2019
|
|
23
|
+
## [16.0.0](https://github.com/ckeditor/ckeditor5-easy-image/compare/v15.0.0...v16.0.0) (December 4, 2019)
|
|
24
24
|
|
|
25
25
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
## [15.0.0](https://github.com/ckeditor/ckeditor5-easy-image/compare/v11.0.5...v15.0.0) (2019
|
|
28
|
+
## [15.0.0](https://github.com/ckeditor/ckeditor5-easy-image/compare/v11.0.5...v15.0.0) (October 23, 2019)
|
|
29
29
|
|
|
30
30
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
## [11.0.5](https://github.com/ckeditor/ckeditor5-easy-image/compare/v11.0.4...v11.0.5) (2019
|
|
33
|
+
## [11.0.5](https://github.com/ckeditor/ckeditor5-easy-image/compare/v11.0.4...v11.0.5) (August 26, 2019)
|
|
34
34
|
|
|
35
35
|
### Other changes
|
|
36
36
|
|
|
37
37
|
* The issue tracker for this package was moved to https://github.com/ckeditor/ckeditor5/issues. See [ckeditor/ckeditor5#1988](https://github.com/ckeditor/ckeditor5/issues/1988). ([d403f73](https://github.com/ckeditor/ckeditor5-easy-image/commit/d403f73))
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
## [11.0.4](https://github.com/ckeditor/ckeditor5-easy-image/compare/v11.0.3...v11.0.4) (2019
|
|
40
|
+
## [11.0.4](https://github.com/ckeditor/ckeditor5-easy-image/compare/v11.0.3...v11.0.4) (July 10, 2019)
|
|
41
41
|
|
|
42
42
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
## [11.0.3](https://github.com/ckeditor/ckeditor5-easy-image/compare/v11.0.2...v11.0.3) (2019
|
|
45
|
+
## [11.0.3](https://github.com/ckeditor/ckeditor5-easy-image/compare/v11.0.2...v11.0.3) (July 4, 2019)
|
|
46
46
|
|
|
47
47
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
## [11.0.2](https://github.com/ckeditor/ckeditor5-easy-image/compare/v11.0.1...v11.0.2) (2019
|
|
50
|
+
## [11.0.2](https://github.com/ckeditor/ckeditor5-easy-image/compare/v11.0.1...v11.0.2) (June 6, 2019)
|
|
51
51
|
|
|
52
52
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
## [11.0.1](https://github.com/ckeditor/ckeditor5-easy-image/compare/v11.0.0...v11.0.1) (2019
|
|
55
|
+
## [11.0.1](https://github.com/ckeditor/ckeditor5-easy-image/compare/v11.0.0...v11.0.1) (April 4, 2019)
|
|
56
56
|
|
|
57
57
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
58
58
|
|
|
59
59
|
|
|
60
|
-
## [11.0.0](https://github.com/ckeditor/ckeditor5-easy-image/compare/v10.0.4...v11.0.0) (2019
|
|
60
|
+
## [11.0.0](https://github.com/ckeditor/ckeditor5-easy-image/compare/v10.0.4...v11.0.0) (February 28, 2019)
|
|
61
61
|
|
|
62
62
|
### BREAKING CHANGES
|
|
63
63
|
|
|
64
64
|
* Upgraded minimal versions of Node to `8.0.0` and npm to `5.7.1`. See: [ckeditor/ckeditor5#1507](https://github.com/ckeditor/ckeditor5/issues/1507). ([612ea3c](https://github.com/ckeditor/ckeditor5-cloud-services/commit/612ea3c))
|
|
65
65
|
|
|
66
66
|
|
|
67
|
-
## [10.0.4](https://github.com/ckeditor/ckeditor5-easy-image/compare/v10.0.3...v10.0.4) (2018
|
|
67
|
+
## [10.0.4](https://github.com/ckeditor/ckeditor5-easy-image/compare/v10.0.3...v10.0.4) (December 5, 2018)
|
|
68
68
|
|
|
69
69
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
70
70
|
|
|
71
71
|
|
|
72
|
-
## [10.0.3](https://github.com/ckeditor/ckeditor5-easy-image/compare/v10.0.2...v10.0.3) (2018
|
|
72
|
+
## [10.0.3](https://github.com/ckeditor/ckeditor5-easy-image/compare/v10.0.2...v10.0.3) (October 8, 2018)
|
|
73
73
|
|
|
74
74
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
75
75
|
|
|
76
76
|
|
|
77
|
-
## [10.0.2](https://github.com/ckeditor/ckeditor5-easy-image/compare/v10.0.1...v10.0.2) (2018
|
|
77
|
+
## [10.0.2](https://github.com/ckeditor/ckeditor5-easy-image/compare/v10.0.1...v10.0.2) (July 18, 2018)
|
|
78
78
|
|
|
79
79
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
## [10.0.1](https://github.com/ckeditor/ckeditor5-easy-image/compare/v10.0.0...v10.0.1) (2018
|
|
82
|
+
## [10.0.1](https://github.com/ckeditor/ckeditor5-easy-image/compare/v10.0.0...v10.0.1) (June 21, 2018)
|
|
83
83
|
|
|
84
84
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
85
85
|
|
|
86
86
|
|
|
87
|
-
## [10.0.0](https://github.com/ckeditor/ckeditor5-easy-image/compare/v1.0.0-beta.4...v10.0.0) (2018
|
|
87
|
+
## [10.0.0](https://github.com/ckeditor/ckeditor5-easy-image/compare/v1.0.0-beta.4...v10.0.0) (April 25, 2018)
|
|
88
88
|
|
|
89
89
|
### Other changes
|
|
90
90
|
|
|
@@ -95,24 +95,24 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
95
95
|
* The license under which CKEditor 5 is released has been changed from a triple GPL, LGPL and MPL license to a GPL2+ only. See [ckeditor/ckeditor5#991](https://github.com/ckeditor/ckeditor5/issues/991) for more information.
|
|
96
96
|
|
|
97
97
|
|
|
98
|
-
## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-easy-image/compare/v1.0.0-beta.2...v1.0.0-beta.4) (2018
|
|
98
|
+
## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-easy-image/compare/v1.0.0-beta.2...v1.0.0-beta.4) (April 19, 2018)
|
|
99
99
|
|
|
100
100
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
101
101
|
|
|
102
102
|
|
|
103
|
-
## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-easy-image/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2018
|
|
103
|
+
## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-easy-image/compare/v1.0.0-beta.1...v1.0.0-beta.2) (April 10, 2018)
|
|
104
104
|
|
|
105
105
|
### Other changes
|
|
106
106
|
|
|
107
107
|
* Aligned to package names changes: `@ckeditor/ckeditor5-cloudservices` was renamed to `@ckeditor/ckeditor5-cloud-services` and `@ckeditor/ckeditor-cloudservices-core` to `@ckeditor/ckeditor-cloud-services-core`. ([ce3abaf](https://github.com/ckeditor/ckeditor5-easy-image/commit/ce3abaf))
|
|
108
108
|
|
|
109
109
|
|
|
110
|
-
## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-easy-image/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (2018
|
|
110
|
+
## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-easy-image/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (March 15, 2018)
|
|
111
111
|
|
|
112
112
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
113
113
|
|
|
114
114
|
|
|
115
|
-
## [1.0.0-alpha.2](https://github.com/ckeditor/ckeditor5-easy-image/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2017
|
|
115
|
+
## [1.0.0-alpha.2](https://github.com/ckeditor/ckeditor5-easy-image/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (November 14, 2017)
|
|
116
116
|
|
|
117
117
|
### Bug fixes
|
|
118
118
|
|
|
@@ -129,6 +129,6 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
129
129
|
* The Easy Image plugin does not use `config.cloudServices.token` anymore. The new option name is `config.cloudServices.tokenUrl` with a URL to the token server.
|
|
130
130
|
|
|
131
131
|
|
|
132
|
-
## 1.0.0-alpha.1 (2017
|
|
132
|
+
## 1.0.0-alpha.1 (October 3, 2017)
|
|
133
133
|
|
|
134
134
|
Internal changes only (updated dependencies, documentation, etc.).
|
package/LICENSE.md
CHANGED
|
@@ -2,7 +2,7 @@ Software License Agreement
|
|
|
2
2
|
==========================
|
|
3
3
|
|
|
4
4
|
**CKEditor 5 Easy Image feature** – https://github.com/ckeditor/ckeditor5-easy-image <br>
|
|
5
|
-
Copyright (c) 2003
|
|
5
|
+
Copyright (c) 2003–2023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
|
|
6
6
|
|
|
7
7
|
Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
|
|
8
8
|
|
|
@@ -14,4 +14,4 @@ Where not otherwise indicated, all CKEditor content is authored by CKSource engi
|
|
|
14
14
|
Trademarks
|
|
15
15
|
----------
|
|
16
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.
|
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-easy-image",
|
|
3
|
-
"version": "40.
|
|
3
|
+
"version": "40.2.0",
|
|
4
4
|
"description": "Easy Image feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
],
|
|
13
13
|
"main": "src/index.js",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"ckeditor5": "40.
|
|
15
|
+
"ckeditor5": "40.2.0"
|
|
16
16
|
},
|
|
17
17
|
"author": "CKSource (http://cksource.com/)",
|
|
18
18
|
"license": "GPL-2.0-or-later",
|
package/src/augmentation.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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
|
-
import type { EasyImage, CloudServicesUploadAdapter } from './index';
|
|
6
|
-
declare module '@ckeditor/ckeditor5-core' {
|
|
7
|
-
interface PluginsMap {
|
|
8
|
-
[EasyImage.pluginName]: EasyImage;
|
|
9
|
-
[CloudServicesUploadAdapter.pluginName]: CloudServicesUploadAdapter;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
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
|
+
import type { EasyImage, CloudServicesUploadAdapter } from './index';
|
|
6
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
7
|
+
interface PluginsMap {
|
|
8
|
+
[EasyImage.pluginName]: EasyImage;
|
|
9
|
+
[CloudServicesUploadAdapter.pluginName]: CloudServicesUploadAdapter;
|
|
10
|
+
}
|
|
11
|
+
}
|
package/src/augmentation.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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
|
-
export {};
|
|
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
|
+
export {};
|
|
@@ -1,32 +1,32 @@
|
|
|
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 } from 'ckeditor5/src/core';
|
|
9
|
-
import { FileRepository } from 'ckeditor5/src/upload';
|
|
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 requires(): readonly ["CloudServices", typeof FileRepository];
|
|
28
|
-
/**
|
|
29
|
-
* @inheritDoc
|
|
30
|
-
*/
|
|
31
|
-
init(): void;
|
|
32
|
-
}
|
|
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 } from 'ckeditor5/src/core';
|
|
9
|
+
import { FileRepository } from 'ckeditor5/src/upload';
|
|
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 requires(): readonly ["CloudServices", typeof FileRepository];
|
|
28
|
+
/**
|
|
29
|
+
* @inheritDoc
|
|
30
|
+
*/
|
|
31
|
+
init(): void;
|
|
32
|
+
}
|
|
@@ -1,67 +1,67 @@
|
|
|
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 } from 'ckeditor5/src/core';
|
|
9
|
-
import { FileRepository } from 'ckeditor5/src/upload';
|
|
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 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
|
-
}
|
|
48
|
-
}
|
|
49
|
-
class Adapter {
|
|
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
|
-
}
|
|
67
|
-
}
|
|
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 } from 'ckeditor5/src/core';
|
|
9
|
+
import { FileRepository } from 'ckeditor5/src/upload';
|
|
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 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
|
+
}
|
|
48
|
+
}
|
|
49
|
+
class Adapter {
|
|
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
|
+
}
|
|
67
|
+
}
|
package/src/easyimage.d.ts
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
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 } from 'ckeditor5/src/core';
|
|
9
|
-
import CloudServicesUploadAdapter from './cloudservicesuploadadapter';
|
|
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 {@glink features/images/image-upload/easy-image "Easy Image integration" guide} 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 requires(): readonly [typeof CloudServicesUploadAdapter, "ImageUpload"];
|
|
43
|
-
/**
|
|
44
|
-
* @inheritDoc
|
|
45
|
-
*/
|
|
46
|
-
init(): void;
|
|
47
|
-
}
|
|
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 } from 'ckeditor5/src/core';
|
|
9
|
+
import CloudServicesUploadAdapter from './cloudservicesuploadadapter';
|
|
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 {@glink features/images/image-upload/easy-image "Easy Image integration" guide} 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 requires(): readonly [typeof CloudServicesUploadAdapter, "ImageUpload"];
|
|
43
|
+
/**
|
|
44
|
+
* @inheritDoc
|
|
45
|
+
*/
|
|
46
|
+
init(): void;
|
|
47
|
+
}
|
package/src/easyimage.js
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
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 } from 'ckeditor5/src/core';
|
|
9
|
-
import { logWarning } from 'ckeditor5/src/utils';
|
|
10
|
-
import CloudServicesUploadAdapter from './cloudservicesuploadadapter';
|
|
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 {@glink features/images/image-upload/easy-image "Easy Image integration" guide} 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 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
|
-
}
|
|
69
|
-
}
|
|
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 } from 'ckeditor5/src/core';
|
|
9
|
+
import { logWarning } from 'ckeditor5/src/utils';
|
|
10
|
+
import CloudServicesUploadAdapter from './cloudservicesuploadadapter';
|
|
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 {@glink features/images/image-upload/easy-image "Easy Image integration" guide} 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 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
|
+
}
|
|
69
|
+
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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';
|
|
10
|
-
import './augmentation';
|
|
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';
|
|
10
|
+
import './augmentation';
|
package/src/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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';
|
|
10
|
-
import './augmentation';
|
|
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';
|
|
10
|
+
import './augmentation';
|
package/build/easy-image.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"easy-image.js","mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE4C;AACU;;AAEtD;AACA;AACA;AACA,6BAA6B,6CAA6C;AAC1E;AACA;AACA,IAAI,qFAAqF;AACzF;AACA;AACA;AACe,yCAAyC,sDAAM;AAC9D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4BAA4B,gEAAc;AAC1C;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,sBAAsB,gEAAc;AACpC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;ACtFA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE4C;AACK;;AAEqB;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,8EAA8E;AACpF;AACA;AACA;AACA,MAAM,+BAA+B;AACrC,MAAM,2CAA2C;AACjD;AACA,YAAY,+EAA+E;AAC3F;AACA;AACA,kBAAkB,qFAAqF;AACvG;AACA;AACA;AACA;AACA,wBAAwB,qFAAqF;AAC7G;AACA;AACA;AACe,wBAAwB,sDAAM;AAC7C;AACA;AACA;AACA;AACA,WAAW,mEAA0B;AACrC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS,yCAAyC;AAClD,SAAS,2CAA2C;AACpD,SAAS,gCAAgC;AACzC;AACA;AACA;AACA;AACA,cAAc,kCAAkC;AAChD;AACA,GAAG,+DAAU;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;AC7EA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;;;ACNA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEmD;AACkC","sources":["webpack://CKEditor5.easyImage/./src/cloudservicesuploadadapter.js","webpack://CKEditor5.easyImage/./src/easyimage.js","webpack://CKEditor5.easyImage/delegated \"./src/core.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.easyImage/delegated \"./src/upload.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.easyImage/delegated \"./src/utils.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.easyImage/external var \"CKEditor5.dll\"","webpack://CKEditor5.easyImage/webpack/bootstrap","webpack://CKEditor5.easyImage/webpack/runtime/define property getters","webpack://CKEditor5.easyImage/webpack/runtime/hasOwnProperty shorthand","webpack://CKEditor5.easyImage/webpack/runtime/make namespace object","webpack://CKEditor5.easyImage/./src/index.js"],"sourcesContent":["/**\n * @license Copyright (c) 2003-2022, 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';\nimport { FileRepository } from 'ckeditor5/src/upload';\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/cloudservices~CloudServicesConfig `config.cloudServices`}.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class CloudServicesUploadAdapter extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'CloudServicesUploadAdapter';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ 'CloudServices', FileRepository ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\n\t\tconst editor = this.editor;\n\n\t\tconst 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\tthis._uploadGateway = editor.plugins.get( '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\n/**\n * @private\n */\nclass Adapter {\n\tconstructor( uploadGateway, loader ) {\n\t\tthis.uploadGateway = uploadGateway;\n\n\t\tthis.loader = loader;\n\t}\n\n\tupload() {\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\tabort() {\n\t\tthis.fileUploader.abort();\n\t}\n}\n\n","/**\n * @license Copyright (c) 2003-2022, 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';\nimport { logWarning } from 'ckeditor5/src/utils';\n\nimport CloudServicesUploadAdapter from './cloudservicesuploadadapter';\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/cloudservices~CloudServicesConfig `config.cloudServices`}.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class EasyImage extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ CloudServicesUploadAdapter, 'ImageUpload' ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\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\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'EasyImage';\n\t}\n}\n","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/core.js\");","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/upload.js\");","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/utils.js\");","module.exports = CKEditor5.dll;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * @license Copyright (c) 2003-2022, 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\n */\n\nexport { default as EasyImage } from './easyimage';\nexport { default as CloudServicesUploadAdapter } from './cloudservicesuploadadapter';\n"],"names":[],"sourceRoot":""}
|