@ckeditor/ckeditor5-upload
Advanced tools
Comparing version 0.0.0-nightly-20250103.0 to 0.0.0-nightly-20250104.0
@@ -660,3 +660,6 @@ /** | ||
// Set headers if specified. | ||
const headers = this.options.headers || {}; | ||
let headers = this.options.headers || {}; | ||
if (typeof headers === 'function') { | ||
headers = headers(file); | ||
} | ||
// Use the withCredentials flag if specified. | ||
@@ -663,0 +666,0 @@ const withCredentials = this.options.withCredentials || false; |
{ | ||
"name": "@ckeditor/ckeditor5-upload", | ||
"version": "0.0.0-nightly-20250103.0", | ||
"version": "0.0.0-nightly-20250104.0", | ||
"description": "Upload feature for CKEditor 5.", | ||
@@ -15,4 +15,4 @@ "keywords": [ | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-core": "0.0.0-nightly-20250103.0", | ||
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-20250103.0" | ||
"@ckeditor/ckeditor5-core": "0.0.0-nightly-20250104.0", | ||
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-20250104.0" | ||
}, | ||
@@ -19,0 +19,0 @@ "author": "CKSource (http://cksource.com/)", |
@@ -168,3 +168,6 @@ /** | ||
// Set headers if specified. | ||
const headers = this.options.headers || {}; | ||
let headers = this.options.headers || {}; | ||
if (typeof headers === 'function') { | ||
headers = headers(file); | ||
} | ||
// Use the withCredentials flag if specified. | ||
@@ -171,0 +174,0 @@ const withCredentials = this.options.withCredentials || false; |
@@ -43,6 +43,8 @@ /** | ||
/** | ||
* An object that defines additional [headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers) sent with | ||
* the request to the server during the upload. This is the right place to implement security mechanisms like | ||
* authentication and [CSRF](https://developer.mozilla.org/en-US/docs/Glossary/CSRF) protection. | ||
* [Headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers) sent with the request to the server during the upload. | ||
* This is the right place to implement security mechanisms like authentication and | ||
* [CSRF](https://developer.mozilla.org/en-US/docs/Glossary/CSRF) protection. | ||
* | ||
* The value can be specified either as an object of key-value pairs or a callback function that returns such an object: | ||
* | ||
* ```ts | ||
@@ -52,2 +54,3 @@ * ClassicEditor | ||
* simpleUpload: { | ||
* // Set headers statically: | ||
* headers: { | ||
@@ -57,6 +60,12 @@ * 'X-CSRF-TOKEN': 'CSRF-Token', | ||
* } | ||
* | ||
* // Or dynamically, based on the file: | ||
* headers: ( file ) => { | ||
* return { | ||
* 'X-File-Name': file.name, | ||
* 'X-File-Size': file.size | ||
* }; | ||
* } | ||
* } | ||
* } ); | ||
* .then( ... ) | ||
* .catch( ... ); | ||
* ``` | ||
@@ -68,3 +77,3 @@ * | ||
*/ | ||
headers?: Record<string, string>; | ||
headers?: Record<string, string> | ((file: File) => Record<string, string>); | ||
/** | ||
@@ -71,0 +80,0 @@ * This flag enables the |
Sorry, the diff of this file is not supported yet
323873
3596
+ Added@ckeditor/ckeditor5-core@0.0.0-nightly-20250104.0(transitive)
+ Added@ckeditor/ckeditor5-engine@0.0.0-nightly-20250104.0(transitive)
+ Added@ckeditor/ckeditor5-ui@0.0.0-nightly-20250104.0(transitive)
+ Added@ckeditor/ckeditor5-utils@0.0.0-nightly-20250104.0(transitive)
+ Added@ckeditor/ckeditor5-watchdog@0.0.0-nightly-20250104.0(transitive)
- Removed@ckeditor/ckeditor5-core@0.0.0-nightly-20250103.0(transitive)
- Removed@ckeditor/ckeditor5-engine@0.0.0-nightly-20250103.0(transitive)
- Removed@ckeditor/ckeditor5-ui@0.0.0-nightly-20250103.0(transitive)
- Removed@ckeditor/ckeditor5-utils@0.0.0-nightly-20250103.0(transitive)
- Removed@ckeditor/ckeditor5-watchdog@0.0.0-nightly-20250103.0(transitive)