@ckeditor/ckeditor5-ckbox 0.0.0-nightly-20250316.0 → 0.0.0-nightly-20250318.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/build/ckbox.js +1 -1
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
- package/src/ckboxutils.d.ts +5 -0
- package/src/ckboxutils.js +22 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-ckbox",
|
3
|
-
"version": "0.0.0-nightly-
|
3
|
+
"version": "0.0.0-nightly-20250318.0",
|
4
4
|
"description": "CKBox integration for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -13,15 +13,15 @@
|
|
13
13
|
"type": "module",
|
14
14
|
"main": "src/index.js",
|
15
15
|
"dependencies": {
|
16
|
-
"@ckeditor/ckeditor5-cloud-services": "0.0.0-nightly-
|
17
|
-
"@ckeditor/ckeditor5-core": "0.0.0-nightly-
|
18
|
-
"@ckeditor/ckeditor5-engine": "0.0.0-nightly-
|
19
|
-
"@ckeditor/ckeditor5-icons": "0.0.0-nightly-
|
20
|
-
"@ckeditor/ckeditor5-image": "0.0.0-nightly-
|
21
|
-
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-
|
22
|
-
"@ckeditor/ckeditor5-upload": "0.0.0-nightly-
|
23
|
-
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-
|
24
|
-
"ckeditor5": "0.0.0-nightly-
|
16
|
+
"@ckeditor/ckeditor5-cloud-services": "0.0.0-nightly-20250318.0",
|
17
|
+
"@ckeditor/ckeditor5-core": "0.0.0-nightly-20250318.0",
|
18
|
+
"@ckeditor/ckeditor5-engine": "0.0.0-nightly-20250318.0",
|
19
|
+
"@ckeditor/ckeditor5-icons": "0.0.0-nightly-20250318.0",
|
20
|
+
"@ckeditor/ckeditor5-image": "0.0.0-nightly-20250318.0",
|
21
|
+
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-20250318.0",
|
22
|
+
"@ckeditor/ckeditor5-upload": "0.0.0-nightly-20250318.0",
|
23
|
+
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-20250318.0",
|
24
|
+
"ckeditor5": "0.0.0-nightly-20250318.0",
|
25
25
|
"blurhash": "2.0.5",
|
26
26
|
"es-toolkit": "1.32.0"
|
27
27
|
},
|
package/src/ckboxutils.d.ts
CHANGED
@@ -51,4 +51,9 @@ export default class CKBoxUtils extends Plugin {
|
|
51
51
|
* If the API returns limited results, the method will collect all items.
|
52
52
|
*/
|
53
53
|
private _getAvailableCategories;
|
54
|
+
/**
|
55
|
+
* Authorize private categories access to the CKBox service. Request sets cookie for the current domain,
|
56
|
+
* that allows user to preview images from private categories.
|
57
|
+
*/
|
58
|
+
private _authorizePrivateCategoriesAccess;
|
54
59
|
}
|
package/src/ckboxutils.js
CHANGED
@@ -81,6 +81,13 @@ export default class CKBoxUtils extends Plugin {
|
|
81
81
|
else {
|
82
82
|
this._token = cloudServices.registerTokenUrl(ckboxTokenUrl);
|
83
83
|
}
|
84
|
+
// Grant access to private categories after token is fetched. This is done within the same promise chain
|
85
|
+
// to ensure all services using the token have access to private categories.
|
86
|
+
// This step is critical as previewing images from private categories requires proper cookies.
|
87
|
+
this._token = this._token.then(async (token) => {
|
88
|
+
await this._authorizePrivateCategoriesAccess(token.value);
|
89
|
+
return token;
|
90
|
+
});
|
84
91
|
}
|
85
92
|
/**
|
86
93
|
* Returns a token used by the CKBox plugin for communication with the CKBox service.
|
@@ -190,4 +197,19 @@ export default class CKBoxUtils extends Plugin {
|
|
190
197
|
});
|
191
198
|
}
|
192
199
|
}
|
200
|
+
/**
|
201
|
+
* Authorize private categories access to the CKBox service. Request sets cookie for the current domain,
|
202
|
+
* that allows user to preview images from private categories.
|
203
|
+
*/
|
204
|
+
async _authorizePrivateCategoriesAccess(token) {
|
205
|
+
const serviceUrl = this.editor.config.get('ckbox.serviceOrigin');
|
206
|
+
const formData = new FormData();
|
207
|
+
formData.set('token', token);
|
208
|
+
await fetch(`${serviceUrl}/categories/authorizePrivateAccess`, {
|
209
|
+
method: 'POST',
|
210
|
+
credentials: 'include',
|
211
|
+
mode: 'no-cors',
|
212
|
+
body: formData
|
213
|
+
});
|
214
|
+
}
|
193
215
|
}
|