@ckeditor/ckeditor5-cloud-services 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 +20 -20
- package/LICENSE.md +2 -2
- package/package.json +2 -2
- package/src/augmentation.d.ts +19 -19
- package/src/augmentation.js +5 -5
- package/src/cloudservices.d.ts +84 -84
- package/src/cloudservices.js +103 -103
- package/src/cloudservicesconfig.d.ts +121 -121
- package/src/cloudservicesconfig.js +5 -5
- package/src/cloudservicescore.d.ts +36 -36
- package/src/cloudservicescore.js +41 -41
- package/src/index.d.ts +14 -14
- package/src/index.js +10 -10
- package/src/token/token.d.ts +96 -96
- package/src/token/token.js +171 -171
- package/src/uploadgateway/fileuploader.d.ts +94 -94
- package/src/uploadgateway/fileuploader.js +183 -183
- package/src/uploadgateway/uploadgateway.d.ts +47 -47
- package/src/uploadgateway/uploadgateway.js +60 -60
- package/build/cloud-services.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,90 +5,90 @@ 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-cloud-services/compare/v18.0.0...v19.0.0) (2020
|
|
8
|
+
## [19.0.0](https://github.com/ckeditor/ckeditor5-cloud-services/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-cloud-services/compare/v17.0.0...v18.0.0) (2020
|
|
13
|
+
## [18.0.0](https://github.com/ckeditor/ckeditor5-cloud-services/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-cloud-services/compare/v16.0.0...v17.0.0) (2020
|
|
18
|
+
## [17.0.0](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v16.0.0...v17.0.0) (February 19, 2020)
|
|
19
19
|
|
|
20
20
|
### Other changes
|
|
21
21
|
|
|
22
22
|
* Changed the `CloudServices` plugin to a context plugin. Part of [ckeditor/ckeditor5#5891](https://github.com/ckeditor/ckeditor5/issues/5891). ([12ca96d](https://github.com/ckeditor/ckeditor5-cloud-services/commit/12ca96d))
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
## [16.0.0](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v15.0.0...v16.0.0) (2019
|
|
25
|
+
## [16.0.0](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v15.0.0...v16.0.0) (December 4, 2019)
|
|
26
26
|
|
|
27
27
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
## [15.0.0](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v11.0.5...v15.0.0) (2019
|
|
30
|
+
## [15.0.0](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v11.0.5...v15.0.0) (October 23, 2019)
|
|
31
31
|
|
|
32
32
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
## [11.0.5](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v11.0.4...v11.0.5) (2019
|
|
35
|
+
## [11.0.5](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v11.0.4...v11.0.5) (August 26, 2019)
|
|
36
36
|
|
|
37
37
|
### Other changes
|
|
38
38
|
|
|
39
39
|
* 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). ([566b650](https://github.com/ckeditor/ckeditor5-cloud-services/commit/566b650))
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
## [11.0.4](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v11.0.3...v11.0.4) (2019
|
|
42
|
+
## [11.0.4](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v11.0.3...v11.0.4) (July 10, 2019)
|
|
43
43
|
|
|
44
44
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
## [11.0.3](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v11.0.2...v11.0.3) (2019
|
|
47
|
+
## [11.0.3](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v11.0.2...v11.0.3) (July 4, 2019)
|
|
48
48
|
|
|
49
49
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
## [11.0.2](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v11.0.1...v11.0.2) (2019
|
|
52
|
+
## [11.0.2](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v11.0.1...v11.0.2) (June 6, 2019)
|
|
53
53
|
|
|
54
54
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
## [11.0.1](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v11.0.0...v11.0.1) (2019
|
|
57
|
+
## [11.0.1](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v11.0.0...v11.0.1) (April 4, 2019)
|
|
58
58
|
|
|
59
59
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
## [11.0.0](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v10.1.1...v11.0.0) (2019
|
|
62
|
+
## [11.0.0](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v10.1.1...v11.0.0) (February 28, 2019)
|
|
63
63
|
|
|
64
64
|
### BREAKING CHANGES
|
|
65
65
|
|
|
66
66
|
* 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))
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
## [10.1.1](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v10.1.0...v10.1.1) (2018
|
|
69
|
+
## [10.1.1](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v10.1.0...v10.1.1) (December 5, 2018)
|
|
70
70
|
|
|
71
71
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
## [10.1.0](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v10.0.2...v10.1.0) (2018
|
|
74
|
+
## [10.1.0](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v10.0.2...v10.1.0) (October 8, 2018)
|
|
75
75
|
|
|
76
76
|
### Features
|
|
77
77
|
|
|
78
78
|
* The `config.cloudService.tokenUrl` will now accept a callback (in addition to accepting a string).
|
|
79
79
|
|
|
80
80
|
|
|
81
|
-
## [10.0.2](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v10.0.1...v10.0.2) (2018
|
|
81
|
+
## [10.0.2](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v10.0.1...v10.0.2) (July 18, 2018)
|
|
82
82
|
|
|
83
83
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
84
84
|
|
|
85
85
|
|
|
86
|
-
## [10.0.1](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v10.0.0...v10.0.1) (2018
|
|
86
|
+
## [10.0.1](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v10.0.0...v10.0.1) (June 21, 2018)
|
|
87
87
|
|
|
88
88
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
89
89
|
|
|
90
90
|
|
|
91
|
-
## [10.0.0](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v1.0.0-beta.4...v10.0.0) (2018
|
|
91
|
+
## [10.0.0](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v1.0.0-beta.4...v10.0.0) (April 25, 2018)
|
|
92
92
|
|
|
93
93
|
### Other changes
|
|
94
94
|
|
|
@@ -99,19 +99,19 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
99
99
|
* 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.
|
|
100
100
|
|
|
101
101
|
|
|
102
|
-
## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v1.0.0-beta.2...v1.0.0-beta.4) (2018
|
|
102
|
+
## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v1.0.0-beta.2...v1.0.0-beta.4) (April 19, 2018)
|
|
103
103
|
|
|
104
104
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
105
105
|
|
|
106
106
|
|
|
107
|
-
## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2018
|
|
107
|
+
## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v1.0.0-beta.1...v1.0.0-beta.2) (April 10, 2018)
|
|
108
108
|
|
|
109
109
|
### Other changes
|
|
110
110
|
|
|
111
111
|
* `@ckeditor/ckeditor5-cloudservices` was renamed to `@ckeditor/ckeditor5-cloud-services` and `@ckeditor/ckeditor-cloudservices-core` to `@ckeditor/ckeditor-cloud-services-core`. ([8182343](https://github.com/ckeditor/ckeditor5-cloud-services/commit/8182343))
|
|
112
112
|
|
|
113
113
|
|
|
114
|
-
## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v1.0.0-alpha.1...v1.0.0-beta.1) (2018
|
|
114
|
+
## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-cloud-services/compare/v1.0.0-alpha.1...v1.0.0-beta.1) (March 15, 2018)
|
|
115
115
|
|
|
116
116
|
### Other changes
|
|
117
117
|
|
|
@@ -122,7 +122,7 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
122
122
|
* The `config.cloudServices.uploadUrl` needs to be defined to your organization's CKEditor Cloud Services upload URL.
|
|
123
123
|
|
|
124
124
|
|
|
125
|
-
## 1.0.0-alpha.1 (2017
|
|
125
|
+
## 1.0.0-alpha.1 (November 14, 2017)
|
|
126
126
|
|
|
127
127
|
### Features
|
|
128
128
|
|
package/LICENSE.md
CHANGED
|
@@ -2,7 +2,7 @@ Software License Agreement
|
|
|
2
2
|
==========================
|
|
3
3
|
|
|
4
4
|
**CKEditor 5 Cloud Services integration** – https://github.com/ckeditor/ckeditor5-cloud-services <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-cloud-services",
|
|
3
|
-
"version": "40.
|
|
3
|
+
"version": "40.2.0",
|
|
4
4
|
"description": "CKEditor 5's Cloud Services integration layer.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"main": "src/index.js",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"ckeditor5": "40.
|
|
14
|
+
"ckeditor5": "40.2.0"
|
|
15
15
|
},
|
|
16
16
|
"author": "CKSource (http://cksource.com/)",
|
|
17
17
|
"license": "GPL-2.0-or-later",
|
package/src/augmentation.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
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 { CloudServices, CloudServicesConfig, CloudServicesCore } from './index';
|
|
6
|
-
declare module '@ckeditor/ckeditor5-core' {
|
|
7
|
-
interface EditorConfig {
|
|
8
|
-
/**
|
|
9
|
-
* The configuration of CKEditor Cloud Services. Introduced by the {@link module:cloud-services/cloudservices~CloudServices} plugin.
|
|
10
|
-
*
|
|
11
|
-
* Read more in {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig}.
|
|
12
|
-
*/
|
|
13
|
-
cloudServices?: CloudServicesConfig;
|
|
14
|
-
}
|
|
15
|
-
interface PluginsMap {
|
|
16
|
-
[CloudServices.pluginName]: CloudServices;
|
|
17
|
-
[CloudServicesCore.pluginName]: CloudServicesCore;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
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 { CloudServices, CloudServicesConfig, CloudServicesCore } from './index';
|
|
6
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
7
|
+
interface EditorConfig {
|
|
8
|
+
/**
|
|
9
|
+
* The configuration of CKEditor Cloud Services. Introduced by the {@link module:cloud-services/cloudservices~CloudServices} plugin.
|
|
10
|
+
*
|
|
11
|
+
* Read more in {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig}.
|
|
12
|
+
*/
|
|
13
|
+
cloudServices?: CloudServicesConfig;
|
|
14
|
+
}
|
|
15
|
+
interface PluginsMap {
|
|
16
|
+
[CloudServices.pluginName]: CloudServices;
|
|
17
|
+
[CloudServicesCore.pluginName]: CloudServicesCore;
|
|
18
|
+
}
|
|
19
|
+
}
|
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 {};
|
package/src/cloudservices.d.ts
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
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 cloud-services/cloudservices
|
|
7
|
-
*/
|
|
8
|
-
import { ContextPlugin } from 'ckeditor5/src/core';
|
|
9
|
-
import CloudServicesCore from './cloudservicescore';
|
|
10
|
-
import type { CloudServicesConfig, TokenUrl } from './cloudservicesconfig';
|
|
11
|
-
import type { InitializedToken } from './token/token';
|
|
12
|
-
/**
|
|
13
|
-
* Plugin introducing the integration between CKEditor 5 and CKEditor Cloud Services .
|
|
14
|
-
*
|
|
15
|
-
* It initializes the token provider based on
|
|
16
|
-
* the {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudService`}.
|
|
17
|
-
*/
|
|
18
|
-
export default class CloudServices extends ContextPlugin implements CloudServicesConfig {
|
|
19
|
-
/**
|
|
20
|
-
* The authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
|
|
21
|
-
* {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
|
|
22
|
-
*/
|
|
23
|
-
readonly tokenUrl?: TokenUrl;
|
|
24
|
-
/**
|
|
25
|
-
* The URL to which the files should be uploaded.
|
|
26
|
-
*/
|
|
27
|
-
readonly uploadUrl?: string;
|
|
28
|
-
/**
|
|
29
|
-
* The URL for web socket communication, used by the `RealTimeCollaborativeEditing` plugin. Every customer (organization in the CKEditor
|
|
30
|
-
* Ecosystem dashboard) has their own, unique URLs to communicate with CKEditor Cloud Services. The URL can be found in the
|
|
31
|
-
* CKEditor Ecosystem customer dashboard.
|
|
32
|
-
*
|
|
33
|
-
* Note: Unlike most plugins, `RealTimeCollaborativeEditing` is not included in any CKEditor 5 build and needs to be installed manually.
|
|
34
|
-
* Check [Collaboration overview](https://ckeditor.com/docs/ckeditor5/latest/features/collaboration/overview.html) for more details.
|
|
35
|
-
*/
|
|
36
|
-
readonly webSocketUrl?: string;
|
|
37
|
-
/**
|
|
38
|
-
* An optional parameter used for integration with CKEditor Cloud Services when uploading the editor build to cloud services.
|
|
39
|
-
*
|
|
40
|
-
* Whenever the editor build or the configuration changes, this parameter should be set to a new, unique value to differentiate
|
|
41
|
-
* the new bundle (build + configuration) from the old ones.
|
|
42
|
-
*/
|
|
43
|
-
readonly bundleVersion?: string;
|
|
44
|
-
/**
|
|
45
|
-
* Other plugins use this token for the authorization process. It handles token requesting and refreshing.
|
|
46
|
-
* Its value is `null` when {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} is not provided.
|
|
47
|
-
*
|
|
48
|
-
* @readonly
|
|
49
|
-
*/
|
|
50
|
-
token: InitializedToken | null;
|
|
51
|
-
/**
|
|
52
|
-
* A map of token object instances keyed by the token URLs.
|
|
53
|
-
*/
|
|
54
|
-
private readonly _tokens;
|
|
55
|
-
/**
|
|
56
|
-
* @inheritDoc
|
|
57
|
-
*/
|
|
58
|
-
static get pluginName(): "CloudServices";
|
|
59
|
-
/**
|
|
60
|
-
* @inheritDoc
|
|
61
|
-
*/
|
|
62
|
-
static get requires(): readonly [typeof CloudServicesCore];
|
|
63
|
-
/**
|
|
64
|
-
* @inheritDoc
|
|
65
|
-
*/
|
|
66
|
-
init(): Promise<void>;
|
|
67
|
-
/**
|
|
68
|
-
* Registers an additional authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
|
|
69
|
-
* {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
|
|
70
|
-
*
|
|
71
|
-
* @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
|
|
72
|
-
*/
|
|
73
|
-
registerTokenUrl(tokenUrl: TokenUrl): Promise<InitializedToken>;
|
|
74
|
-
/**
|
|
75
|
-
* Returns an authentication token provider previously registered by {@link #registerTokenUrl}.
|
|
76
|
-
*
|
|
77
|
-
* @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
|
|
78
|
-
*/
|
|
79
|
-
getTokenFor(tokenUrl: TokenUrl): InitializedToken;
|
|
80
|
-
/**
|
|
81
|
-
* @inheritDoc
|
|
82
|
-
*/
|
|
83
|
-
destroy(): void;
|
|
84
|
-
}
|
|
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 cloud-services/cloudservices
|
|
7
|
+
*/
|
|
8
|
+
import { ContextPlugin } from 'ckeditor5/src/core';
|
|
9
|
+
import CloudServicesCore from './cloudservicescore';
|
|
10
|
+
import type { CloudServicesConfig, TokenUrl } from './cloudservicesconfig';
|
|
11
|
+
import type { InitializedToken } from './token/token';
|
|
12
|
+
/**
|
|
13
|
+
* Plugin introducing the integration between CKEditor 5 and CKEditor Cloud Services .
|
|
14
|
+
*
|
|
15
|
+
* It initializes the token provider based on
|
|
16
|
+
* the {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudService`}.
|
|
17
|
+
*/
|
|
18
|
+
export default class CloudServices extends ContextPlugin implements CloudServicesConfig {
|
|
19
|
+
/**
|
|
20
|
+
* The authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
|
|
21
|
+
* {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
|
|
22
|
+
*/
|
|
23
|
+
readonly tokenUrl?: TokenUrl;
|
|
24
|
+
/**
|
|
25
|
+
* The URL to which the files should be uploaded.
|
|
26
|
+
*/
|
|
27
|
+
readonly uploadUrl?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The URL for web socket communication, used by the `RealTimeCollaborativeEditing` plugin. Every customer (organization in the CKEditor
|
|
30
|
+
* Ecosystem dashboard) has their own, unique URLs to communicate with CKEditor Cloud Services. The URL can be found in the
|
|
31
|
+
* CKEditor Ecosystem customer dashboard.
|
|
32
|
+
*
|
|
33
|
+
* Note: Unlike most plugins, `RealTimeCollaborativeEditing` is not included in any CKEditor 5 build and needs to be installed manually.
|
|
34
|
+
* Check [Collaboration overview](https://ckeditor.com/docs/ckeditor5/latest/features/collaboration/overview.html) for more details.
|
|
35
|
+
*/
|
|
36
|
+
readonly webSocketUrl?: string;
|
|
37
|
+
/**
|
|
38
|
+
* An optional parameter used for integration with CKEditor Cloud Services when uploading the editor build to cloud services.
|
|
39
|
+
*
|
|
40
|
+
* Whenever the editor build or the configuration changes, this parameter should be set to a new, unique value to differentiate
|
|
41
|
+
* the new bundle (build + configuration) from the old ones.
|
|
42
|
+
*/
|
|
43
|
+
readonly bundleVersion?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Other plugins use this token for the authorization process. It handles token requesting and refreshing.
|
|
46
|
+
* Its value is `null` when {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} is not provided.
|
|
47
|
+
*
|
|
48
|
+
* @readonly
|
|
49
|
+
*/
|
|
50
|
+
token: InitializedToken | null;
|
|
51
|
+
/**
|
|
52
|
+
* A map of token object instances keyed by the token URLs.
|
|
53
|
+
*/
|
|
54
|
+
private readonly _tokens;
|
|
55
|
+
/**
|
|
56
|
+
* @inheritDoc
|
|
57
|
+
*/
|
|
58
|
+
static get pluginName(): "CloudServices";
|
|
59
|
+
/**
|
|
60
|
+
* @inheritDoc
|
|
61
|
+
*/
|
|
62
|
+
static get requires(): readonly [typeof CloudServicesCore];
|
|
63
|
+
/**
|
|
64
|
+
* @inheritDoc
|
|
65
|
+
*/
|
|
66
|
+
init(): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Registers an additional authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
|
|
69
|
+
* {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
|
|
70
|
+
*
|
|
71
|
+
* @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
|
|
72
|
+
*/
|
|
73
|
+
registerTokenUrl(tokenUrl: TokenUrl): Promise<InitializedToken>;
|
|
74
|
+
/**
|
|
75
|
+
* Returns an authentication token provider previously registered by {@link #registerTokenUrl}.
|
|
76
|
+
*
|
|
77
|
+
* @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
|
|
78
|
+
*/
|
|
79
|
+
getTokenFor(tokenUrl: TokenUrl): InitializedToken;
|
|
80
|
+
/**
|
|
81
|
+
* @inheritDoc
|
|
82
|
+
*/
|
|
83
|
+
destroy(): void;
|
|
84
|
+
}
|
package/src/cloudservices.js
CHANGED
|
@@ -1,103 +1,103 @@
|
|
|
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 cloud-services/cloudservices
|
|
7
|
-
*/
|
|
8
|
-
import { ContextPlugin } from 'ckeditor5/src/core';
|
|
9
|
-
import { CKEditorError } from 'ckeditor5/src/utils';
|
|
10
|
-
import CloudServicesCore from './cloudservicescore';
|
|
11
|
-
/**
|
|
12
|
-
* Plugin introducing the integration between CKEditor 5 and CKEditor Cloud Services .
|
|
13
|
-
*
|
|
14
|
-
* It initializes the token provider based on
|
|
15
|
-
* the {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudService`}.
|
|
16
|
-
*/
|
|
17
|
-
export default class CloudServices extends ContextPlugin {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments);
|
|
20
|
-
/**
|
|
21
|
-
* Other plugins use this token for the authorization process. It handles token requesting and refreshing.
|
|
22
|
-
* Its value is `null` when {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} is not provided.
|
|
23
|
-
*
|
|
24
|
-
* @readonly
|
|
25
|
-
*/
|
|
26
|
-
this.token = null;
|
|
27
|
-
/**
|
|
28
|
-
* A map of token object instances keyed by the token URLs.
|
|
29
|
-
*/
|
|
30
|
-
this._tokens = new Map();
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* @inheritDoc
|
|
34
|
-
*/
|
|
35
|
-
static get pluginName() {
|
|
36
|
-
return 'CloudServices';
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* @inheritDoc
|
|
40
|
-
*/
|
|
41
|
-
static get requires() {
|
|
42
|
-
return [CloudServicesCore];
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* @inheritDoc
|
|
46
|
-
*/
|
|
47
|
-
async init() {
|
|
48
|
-
const config = this.context.config;
|
|
49
|
-
const options = config.get('cloudServices') || {};
|
|
50
|
-
for (const [key, value] of Object.entries(options)) {
|
|
51
|
-
this[key] = value;
|
|
52
|
-
}
|
|
53
|
-
if (!this.tokenUrl) {
|
|
54
|
-
this.token = null;
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const cloudServicesCore = this.context.plugins.get('CloudServicesCore');
|
|
58
|
-
this.token = await cloudServicesCore.createToken(this.tokenUrl).init();
|
|
59
|
-
this._tokens.set(this.tokenUrl, this.token);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Registers an additional authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
|
|
63
|
-
* {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
|
|
64
|
-
*
|
|
65
|
-
* @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
|
|
66
|
-
*/
|
|
67
|
-
async registerTokenUrl(tokenUrl) {
|
|
68
|
-
// Reuse the token instance in case of multiple features using the same token URL.
|
|
69
|
-
if (this._tokens.has(tokenUrl)) {
|
|
70
|
-
return this.getTokenFor(tokenUrl);
|
|
71
|
-
}
|
|
72
|
-
const cloudServicesCore = this.context.plugins.get('CloudServicesCore');
|
|
73
|
-
const token = await cloudServicesCore.createToken(tokenUrl).init();
|
|
74
|
-
this._tokens.set(tokenUrl, token);
|
|
75
|
-
return token;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Returns an authentication token provider previously registered by {@link #registerTokenUrl}.
|
|
79
|
-
*
|
|
80
|
-
* @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
|
|
81
|
-
*/
|
|
82
|
-
getTokenFor(tokenUrl) {
|
|
83
|
-
const token = this._tokens.get(tokenUrl);
|
|
84
|
-
if (!token) {
|
|
85
|
-
/**
|
|
86
|
-
* The provided `tokenUrl` was not registered by {@link module:cloud-services/cloudservices~CloudServices#registerTokenUrl}.
|
|
87
|
-
*
|
|
88
|
-
* @error cloudservices-token-not-registered
|
|
89
|
-
*/
|
|
90
|
-
throw new CKEditorError('cloudservices-token-not-registered', this);
|
|
91
|
-
}
|
|
92
|
-
return token;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* @inheritDoc
|
|
96
|
-
*/
|
|
97
|
-
destroy() {
|
|
98
|
-
super.destroy();
|
|
99
|
-
for (const token of this._tokens.values()) {
|
|
100
|
-
token.destroy();
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
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 cloud-services/cloudservices
|
|
7
|
+
*/
|
|
8
|
+
import { ContextPlugin } from 'ckeditor5/src/core';
|
|
9
|
+
import { CKEditorError } from 'ckeditor5/src/utils';
|
|
10
|
+
import CloudServicesCore from './cloudservicescore';
|
|
11
|
+
/**
|
|
12
|
+
* Plugin introducing the integration between CKEditor 5 and CKEditor Cloud Services .
|
|
13
|
+
*
|
|
14
|
+
* It initializes the token provider based on
|
|
15
|
+
* the {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudService`}.
|
|
16
|
+
*/
|
|
17
|
+
export default class CloudServices extends ContextPlugin {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
/**
|
|
21
|
+
* Other plugins use this token for the authorization process. It handles token requesting and refreshing.
|
|
22
|
+
* Its value is `null` when {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} is not provided.
|
|
23
|
+
*
|
|
24
|
+
* @readonly
|
|
25
|
+
*/
|
|
26
|
+
this.token = null;
|
|
27
|
+
/**
|
|
28
|
+
* A map of token object instances keyed by the token URLs.
|
|
29
|
+
*/
|
|
30
|
+
this._tokens = new Map();
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @inheritDoc
|
|
34
|
+
*/
|
|
35
|
+
static get pluginName() {
|
|
36
|
+
return 'CloudServices';
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @inheritDoc
|
|
40
|
+
*/
|
|
41
|
+
static get requires() {
|
|
42
|
+
return [CloudServicesCore];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @inheritDoc
|
|
46
|
+
*/
|
|
47
|
+
async init() {
|
|
48
|
+
const config = this.context.config;
|
|
49
|
+
const options = config.get('cloudServices') || {};
|
|
50
|
+
for (const [key, value] of Object.entries(options)) {
|
|
51
|
+
this[key] = value;
|
|
52
|
+
}
|
|
53
|
+
if (!this.tokenUrl) {
|
|
54
|
+
this.token = null;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const cloudServicesCore = this.context.plugins.get('CloudServicesCore');
|
|
58
|
+
this.token = await cloudServicesCore.createToken(this.tokenUrl).init();
|
|
59
|
+
this._tokens.set(this.tokenUrl, this.token);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Registers an additional authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
|
|
63
|
+
* {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
|
|
64
|
+
*
|
|
65
|
+
* @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
|
|
66
|
+
*/
|
|
67
|
+
async registerTokenUrl(tokenUrl) {
|
|
68
|
+
// Reuse the token instance in case of multiple features using the same token URL.
|
|
69
|
+
if (this._tokens.has(tokenUrl)) {
|
|
70
|
+
return this.getTokenFor(tokenUrl);
|
|
71
|
+
}
|
|
72
|
+
const cloudServicesCore = this.context.plugins.get('CloudServicesCore');
|
|
73
|
+
const token = await cloudServicesCore.createToken(tokenUrl).init();
|
|
74
|
+
this._tokens.set(tokenUrl, token);
|
|
75
|
+
return token;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Returns an authentication token provider previously registered by {@link #registerTokenUrl}.
|
|
79
|
+
*
|
|
80
|
+
* @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
|
|
81
|
+
*/
|
|
82
|
+
getTokenFor(tokenUrl) {
|
|
83
|
+
const token = this._tokens.get(tokenUrl);
|
|
84
|
+
if (!token) {
|
|
85
|
+
/**
|
|
86
|
+
* The provided `tokenUrl` was not registered by {@link module:cloud-services/cloudservices~CloudServices#registerTokenUrl}.
|
|
87
|
+
*
|
|
88
|
+
* @error cloudservices-token-not-registered
|
|
89
|
+
*/
|
|
90
|
+
throw new CKEditorError('cloudservices-token-not-registered', this);
|
|
91
|
+
}
|
|
92
|
+
return token;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* @inheritDoc
|
|
96
|
+
*/
|
|
97
|
+
destroy() {
|
|
98
|
+
super.destroy();
|
|
99
|
+
for (const token of this._tokens.values()) {
|
|
100
|
+
token.destroy();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|