@ckeditor/ckeditor5-upload 40.0.0 → 40.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +30 -30
- package/LICENSE.md +2 -2
- package/package.json +4 -4
- package/src/adapters/base64uploadadapter.d.ts +33 -33
- package/src/adapters/base64uploadadapter.js +81 -81
- package/src/adapters/simpleuploadadapter.d.ts +48 -48
- package/src/adapters/simpleuploadadapter.js +175 -175
- package/src/augmentation.d.ts +20 -20
- package/src/augmentation.js +5 -5
- package/src/filereader.d.ts +56 -56
- package/src/filereader.js +71 -71
- package/src/filerepository.d.ts +342 -342
- package/src/filerepository.js +383 -383
- package/src/index.d.ts +13 -13
- package/src/index.js +12 -12
- package/src/ui/filedialogbuttonview.d.ts +83 -84
- package/src/ui/filedialogbuttonview.js +102 -108
- package/src/uploadconfig.d.ts +90 -90
- package/src/uploadconfig.js +5 -5
package/src/index.d.ts
CHANGED
@@ -1,13 +1,13 @@
|
|
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 upload
|
7
|
-
*/
|
8
|
-
export { default as FileRepository, type UploadAdapter, type UploadResponse, type FileLoader } from './filerepository';
|
9
|
-
export { default as FileDialogButtonView } from './ui/filedialogbuttonview';
|
10
|
-
export { default as Base64UploadAdapter } from './adapters/base64uploadadapter';
|
11
|
-
export { default as SimpleUploadAdapter } from './adapters/simpleuploadadapter';
|
12
|
-
export type { SimpleUploadConfig } from './uploadconfig';
|
13
|
-
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 upload
|
7
|
+
*/
|
8
|
+
export { default as FileRepository, type UploadAdapter, type UploadResponse, type FileLoader } from './filerepository';
|
9
|
+
export { default as FileDialogButtonView } from './ui/filedialogbuttonview';
|
10
|
+
export { default as Base64UploadAdapter } from './adapters/base64uploadadapter';
|
11
|
+
export { default as SimpleUploadAdapter } from './adapters/simpleuploadadapter';
|
12
|
+
export type { SimpleUploadConfig } from './uploadconfig';
|
13
|
+
import './augmentation';
|
package/src/index.js
CHANGED
@@ -1,12 +1,12 @@
|
|
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 upload
|
7
|
-
*/
|
8
|
-
export { default as FileRepository } from './filerepository';
|
9
|
-
export { default as FileDialogButtonView } from './ui/filedialogbuttonview';
|
10
|
-
export { default as Base64UploadAdapter } from './adapters/base64uploadadapter';
|
11
|
-
export { default as SimpleUploadAdapter } from './adapters/simpleuploadadapter';
|
12
|
-
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 upload
|
7
|
+
*/
|
8
|
+
export { default as FileRepository } from './filerepository';
|
9
|
+
export { default as FileDialogButtonView } from './ui/filedialogbuttonview';
|
10
|
+
export { default as Base64UploadAdapter } from './adapters/base64uploadadapter';
|
11
|
+
export { default as SimpleUploadAdapter } from './adapters/simpleuploadadapter';
|
12
|
+
import './augmentation';
|
@@ -1,84 +1,83 @@
|
|
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 upload/ui/filedialogbuttonview
|
7
|
-
*/
|
8
|
-
import { ButtonView
|
9
|
-
import type { Locale } from '@ckeditor/ckeditor5-utils';
|
10
|
-
/**
|
11
|
-
* The file dialog button view.
|
12
|
-
*
|
13
|
-
* This component provides a button that opens the native file selection dialog.
|
14
|
-
* It can be used to implement the UI of a file upload feature.
|
15
|
-
*
|
16
|
-
* ```ts
|
17
|
-
* const view = new FileDialogButtonView( locale );
|
18
|
-
*
|
19
|
-
* view.set( {
|
20
|
-
* acceptedType: 'image/*',
|
21
|
-
* allowMultipleFiles: true
|
22
|
-
*
|
23
|
-
*
|
24
|
-
*
|
25
|
-
*
|
26
|
-
*
|
27
|
-
*
|
28
|
-
*
|
29
|
-
*
|
30
|
-
*
|
31
|
-
*
|
32
|
-
*
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
*
|
48
|
-
* * `
|
49
|
-
* * `
|
50
|
-
*
|
51
|
-
*
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
*
|
57
|
-
*
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
*
|
72
|
-
*
|
73
|
-
*
|
74
|
-
*
|
75
|
-
*
|
76
|
-
*
|
77
|
-
*
|
78
|
-
*
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
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 upload/ui/filedialogbuttonview
|
7
|
+
*/
|
8
|
+
import { ButtonView } from '@ckeditor/ckeditor5-ui';
|
9
|
+
import type { Locale } from '@ckeditor/ckeditor5-utils';
|
10
|
+
/**
|
11
|
+
* The file dialog button view.
|
12
|
+
*
|
13
|
+
* This component provides a button that opens the native file selection dialog.
|
14
|
+
* It can be used to implement the UI of a file upload feature.
|
15
|
+
*
|
16
|
+
* ```ts
|
17
|
+
* const view = new FileDialogButtonView( locale );
|
18
|
+
*
|
19
|
+
* view.set( {
|
20
|
+
* acceptedType: 'image/*',
|
21
|
+
* allowMultipleFiles: true
|
22
|
+
* label: t( 'Insert image' ),
|
23
|
+
* icon: imageIcon,
|
24
|
+
* tooltip: true
|
25
|
+
* } );
|
26
|
+
*
|
27
|
+
* view.on( 'done', ( evt, files ) => {
|
28
|
+
* for ( const file of Array.from( files ) ) {
|
29
|
+
* console.log( 'Selected file', file );
|
30
|
+
* }
|
31
|
+
* } );
|
32
|
+
* ```
|
33
|
+
*/
|
34
|
+
export default class FileDialogButtonView extends ButtonView {
|
35
|
+
/**
|
36
|
+
* The button view of the component.
|
37
|
+
*
|
38
|
+
* @deprecated
|
39
|
+
*/
|
40
|
+
buttonView: ButtonView;
|
41
|
+
/**
|
42
|
+
* A hidden `<input>` view used to execute file dialog.
|
43
|
+
*/
|
44
|
+
private _fileInputView;
|
45
|
+
/**
|
46
|
+
* Accepted file types. Can be provided in form of file extensions, media type or one of:
|
47
|
+
* * `audio/*`,
|
48
|
+
* * `video/*`,
|
49
|
+
* * `image/*`.
|
50
|
+
*
|
51
|
+
* @observable
|
52
|
+
*/
|
53
|
+
acceptedType: string;
|
54
|
+
/**
|
55
|
+
* Indicates if multiple files can be selected. Defaults to `true`.
|
56
|
+
*
|
57
|
+
* @observable
|
58
|
+
*/
|
59
|
+
allowMultipleFiles: boolean;
|
60
|
+
/**
|
61
|
+
* @inheritDoc
|
62
|
+
*/
|
63
|
+
constructor(locale?: Locale);
|
64
|
+
/**
|
65
|
+
* @inheritDoc
|
66
|
+
*/
|
67
|
+
render(): void;
|
68
|
+
}
|
69
|
+
/**
|
70
|
+
* Fired when file dialog is closed with file selected.
|
71
|
+
*
|
72
|
+
* ```ts
|
73
|
+
* view.on( 'done', ( evt, files ) => {
|
74
|
+
* for ( const file of files ) {
|
75
|
+
* console.log( 'Selected file', file );
|
76
|
+
* }
|
77
|
+
* }
|
78
|
+
* ```
|
79
|
+
*/
|
80
|
+
export type FileInputViewDoneEvent = {
|
81
|
+
name: 'done';
|
82
|
+
args: [files: FileList];
|
83
|
+
};
|
@@ -1,108 +1,102 @@
|
|
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 upload/ui/filedialogbuttonview
|
7
|
-
*/
|
8
|
-
import { ButtonView, View } from '@ckeditor/ckeditor5-ui';
|
9
|
-
/**
|
10
|
-
* The file dialog button view.
|
11
|
-
*
|
12
|
-
* This component provides a button that opens the native file selection dialog.
|
13
|
-
* It can be used to implement the UI of a file upload feature.
|
14
|
-
*
|
15
|
-
* ```ts
|
16
|
-
* const view = new FileDialogButtonView( locale );
|
17
|
-
*
|
18
|
-
* view.set( {
|
19
|
-
* acceptedType: 'image/*',
|
20
|
-
* allowMultipleFiles: true
|
21
|
-
*
|
22
|
-
*
|
23
|
-
*
|
24
|
-
*
|
25
|
-
*
|
26
|
-
*
|
27
|
-
*
|
28
|
-
*
|
29
|
-
*
|
30
|
-
*
|
31
|
-
*
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
this.
|
43
|
-
this._fileInputView
|
44
|
-
this._fileInputView.
|
45
|
-
this.
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
attributes: {
|
50
|
-
class: 'ck-file-dialog-button'
|
51
|
-
}
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
}
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
}
|
102
|
-
|
103
|
-
* Opens file dialog.
|
104
|
-
*/
|
105
|
-
open() {
|
106
|
-
this.element.click();
|
107
|
-
}
|
108
|
-
}
|
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 upload/ui/filedialogbuttonview
|
7
|
+
*/
|
8
|
+
import { ButtonView, View } from '@ckeditor/ckeditor5-ui';
|
9
|
+
/**
|
10
|
+
* The file dialog button view.
|
11
|
+
*
|
12
|
+
* This component provides a button that opens the native file selection dialog.
|
13
|
+
* It can be used to implement the UI of a file upload feature.
|
14
|
+
*
|
15
|
+
* ```ts
|
16
|
+
* const view = new FileDialogButtonView( locale );
|
17
|
+
*
|
18
|
+
* view.set( {
|
19
|
+
* acceptedType: 'image/*',
|
20
|
+
* allowMultipleFiles: true
|
21
|
+
* label: t( 'Insert image' ),
|
22
|
+
* icon: imageIcon,
|
23
|
+
* tooltip: true
|
24
|
+
* } );
|
25
|
+
*
|
26
|
+
* view.on( 'done', ( evt, files ) => {
|
27
|
+
* for ( const file of Array.from( files ) ) {
|
28
|
+
* console.log( 'Selected file', file );
|
29
|
+
* }
|
30
|
+
* } );
|
31
|
+
* ```
|
32
|
+
*/
|
33
|
+
export default class FileDialogButtonView extends ButtonView {
|
34
|
+
/**
|
35
|
+
* @inheritDoc
|
36
|
+
*/
|
37
|
+
constructor(locale) {
|
38
|
+
super(locale);
|
39
|
+
// For backward compatibility.
|
40
|
+
this.buttonView = this;
|
41
|
+
this._fileInputView = new FileInputView(locale);
|
42
|
+
this._fileInputView.bind('acceptedType').to(this);
|
43
|
+
this._fileInputView.bind('allowMultipleFiles').to(this);
|
44
|
+
this._fileInputView.delegate('done').to(this);
|
45
|
+
this.on('execute', () => {
|
46
|
+
this._fileInputView.open();
|
47
|
+
});
|
48
|
+
this.extendTemplate({
|
49
|
+
attributes: {
|
50
|
+
class: 'ck-file-dialog-button'
|
51
|
+
}
|
52
|
+
});
|
53
|
+
}
|
54
|
+
/**
|
55
|
+
* @inheritDoc
|
56
|
+
*/
|
57
|
+
render() {
|
58
|
+
super.render();
|
59
|
+
this.children.add(this._fileInputView);
|
60
|
+
}
|
61
|
+
}
|
62
|
+
/**
|
63
|
+
* The hidden file input view class.
|
64
|
+
*/
|
65
|
+
class FileInputView extends View {
|
66
|
+
/**
|
67
|
+
* @inheritDoc
|
68
|
+
*/
|
69
|
+
constructor(locale) {
|
70
|
+
super(locale);
|
71
|
+
this.set('acceptedType', undefined);
|
72
|
+
this.set('allowMultipleFiles', false);
|
73
|
+
const bind = this.bindTemplate;
|
74
|
+
this.setTemplate({
|
75
|
+
tag: 'input',
|
76
|
+
attributes: {
|
77
|
+
class: [
|
78
|
+
'ck-hidden'
|
79
|
+
],
|
80
|
+
type: 'file',
|
81
|
+
tabindex: '-1',
|
82
|
+
accept: bind.to('acceptedType'),
|
83
|
+
multiple: bind.to('allowMultipleFiles')
|
84
|
+
},
|
85
|
+
on: {
|
86
|
+
// Removing from code coverage since we cannot programmatically set input element files.
|
87
|
+
change: bind.to(/* istanbul ignore next -- @preserve */ () => {
|
88
|
+
if (this.element && this.element.files && this.element.files.length) {
|
89
|
+
this.fire('done', this.element.files);
|
90
|
+
}
|
91
|
+
this.element.value = '';
|
92
|
+
})
|
93
|
+
}
|
94
|
+
});
|
95
|
+
}
|
96
|
+
/**
|
97
|
+
* Opens file dialog.
|
98
|
+
*/
|
99
|
+
open() {
|
100
|
+
this.element.click();
|
101
|
+
}
|
102
|
+
}
|
package/src/uploadconfig.d.ts
CHANGED
@@ -1,90 +1,90 @@
|
|
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 upload/uploadconfig
|
7
|
-
*/
|
8
|
-
/**
|
9
|
-
* The configuration of the {@link module:upload/adapters/simpleuploadadapter~SimpleUploadAdapter simple upload adapter}.
|
10
|
-
*
|
11
|
-
* ```ts
|
12
|
-
* ClassicEditor
|
13
|
-
* .create( editorElement, {
|
14
|
-
* simpleUpload: {
|
15
|
-
* // The URL the images are uploaded to.
|
16
|
-
* uploadUrl: 'http://example.com',
|
17
|
-
*
|
18
|
-
* // Headers sent along with the XMLHttpRequest to the upload server.
|
19
|
-
* headers: {
|
20
|
-
* ...
|
21
|
-
* }
|
22
|
-
* }
|
23
|
-
* } );
|
24
|
-
* .then( ... )
|
25
|
-
* .catch( ... );
|
26
|
-
* ```
|
27
|
-
*
|
28
|
-
* See the {@glink features/images/image-upload/simple-upload-adapter "Simple upload adapter"} guide to learn more.
|
29
|
-
*
|
30
|
-
* See {@link module:core/editor/editorconfig~EditorConfig all editor configuration options}.
|
31
|
-
*/
|
32
|
-
export interface SimpleUploadConfig {
|
33
|
-
/**
|
34
|
-
* The path (URL) to the server (application) which handles the file upload. When specified, enables the automatic
|
35
|
-
* upload of resources (images) inserted into the editor content.
|
36
|
-
*
|
37
|
-
* Learn more about the server application requirements in the
|
38
|
-
* {@glink features/images/image-upload/simple-upload-adapter#server-side-configuration "Server-side configuration"} section
|
39
|
-
* of the feature guide.
|
40
|
-
*/
|
41
|
-
uploadUrl: string;
|
42
|
-
/**
|
43
|
-
* An object that defines additional [headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers) sent with
|
44
|
-
* the request to the server during the upload. This is the right place to implement security mechanisms like
|
45
|
-
* authentication and [CSRF](https://developer.mozilla.org/en-US/docs/Glossary/CSRF) protection.
|
46
|
-
*
|
47
|
-
* ```ts
|
48
|
-
* ClassicEditor
|
49
|
-
* .create( editorElement, {
|
50
|
-
* simpleUpload: {
|
51
|
-
* headers: {
|
52
|
-
* 'X-CSRF-TOKEN': 'CSRF-Token',
|
53
|
-
* Authorization: 'Bearer <JSON Web Token>'
|
54
|
-
* }
|
55
|
-
* }
|
56
|
-
* } );
|
57
|
-
* .then( ... )
|
58
|
-
* .catch( ... );
|
59
|
-
* ```
|
60
|
-
*
|
61
|
-
* Learn more about the server application requirements in the
|
62
|
-
* {@glink features/images/image-upload/simple-upload-adapter#server-side-configuration "Server-side configuration"} section
|
63
|
-
* of the feature guide.
|
64
|
-
*/
|
65
|
-
headers?: Record<string, string>;
|
66
|
-
/**
|
67
|
-
* This flag enables the
|
68
|
-
* [`withCredentials`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials)
|
69
|
-
* property of the request sent to the server during the upload. It affects cross-site requests only and, for instance,
|
70
|
-
* allows credentials such as cookies to be sent along with the request.
|
71
|
-
*
|
72
|
-
* ```ts
|
73
|
-
* ClassicEditor
|
74
|
-
* .create( editorElement, {
|
75
|
-
* simpleUpload: {
|
76
|
-
* withCredentials: true
|
77
|
-
* }
|
78
|
-
* } );
|
79
|
-
* .then( ... )
|
80
|
-
* .catch( ... );
|
81
|
-
* ```
|
82
|
-
*
|
83
|
-
* Learn more about the server application requirements in the
|
84
|
-
* {@glink features/images/image-upload/simple-upload-adapter#server-side-configuration "Server-side configuration"} section
|
85
|
-
* of the feature guide.
|
86
|
-
*
|
87
|
-
* @default false
|
88
|
-
*/
|
89
|
-
withCredentials?: boolean;
|
90
|
-
}
|
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 upload/uploadconfig
|
7
|
+
*/
|
8
|
+
/**
|
9
|
+
* The configuration of the {@link module:upload/adapters/simpleuploadadapter~SimpleUploadAdapter simple upload adapter}.
|
10
|
+
*
|
11
|
+
* ```ts
|
12
|
+
* ClassicEditor
|
13
|
+
* .create( editorElement, {
|
14
|
+
* simpleUpload: {
|
15
|
+
* // The URL the images are uploaded to.
|
16
|
+
* uploadUrl: 'http://example.com',
|
17
|
+
*
|
18
|
+
* // Headers sent along with the XMLHttpRequest to the upload server.
|
19
|
+
* headers: {
|
20
|
+
* ...
|
21
|
+
* }
|
22
|
+
* }
|
23
|
+
* } );
|
24
|
+
* .then( ... )
|
25
|
+
* .catch( ... );
|
26
|
+
* ```
|
27
|
+
*
|
28
|
+
* See the {@glink features/images/image-upload/simple-upload-adapter "Simple upload adapter"} guide to learn more.
|
29
|
+
*
|
30
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor configuration options}.
|
31
|
+
*/
|
32
|
+
export interface SimpleUploadConfig {
|
33
|
+
/**
|
34
|
+
* The path (URL) to the server (application) which handles the file upload. When specified, enables the automatic
|
35
|
+
* upload of resources (images) inserted into the editor content.
|
36
|
+
*
|
37
|
+
* Learn more about the server application requirements in the
|
38
|
+
* {@glink features/images/image-upload/simple-upload-adapter#server-side-configuration "Server-side configuration"} section
|
39
|
+
* of the feature guide.
|
40
|
+
*/
|
41
|
+
uploadUrl: string;
|
42
|
+
/**
|
43
|
+
* An object that defines additional [headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers) sent with
|
44
|
+
* the request to the server during the upload. This is the right place to implement security mechanisms like
|
45
|
+
* authentication and [CSRF](https://developer.mozilla.org/en-US/docs/Glossary/CSRF) protection.
|
46
|
+
*
|
47
|
+
* ```ts
|
48
|
+
* ClassicEditor
|
49
|
+
* .create( editorElement, {
|
50
|
+
* simpleUpload: {
|
51
|
+
* headers: {
|
52
|
+
* 'X-CSRF-TOKEN': 'CSRF-Token',
|
53
|
+
* Authorization: 'Bearer <JSON Web Token>'
|
54
|
+
* }
|
55
|
+
* }
|
56
|
+
* } );
|
57
|
+
* .then( ... )
|
58
|
+
* .catch( ... );
|
59
|
+
* ```
|
60
|
+
*
|
61
|
+
* Learn more about the server application requirements in the
|
62
|
+
* {@glink features/images/image-upload/simple-upload-adapter#server-side-configuration "Server-side configuration"} section
|
63
|
+
* of the feature guide.
|
64
|
+
*/
|
65
|
+
headers?: Record<string, string>;
|
66
|
+
/**
|
67
|
+
* This flag enables the
|
68
|
+
* [`withCredentials`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials)
|
69
|
+
* property of the request sent to the server during the upload. It affects cross-site requests only and, for instance,
|
70
|
+
* allows credentials such as cookies to be sent along with the request.
|
71
|
+
*
|
72
|
+
* ```ts
|
73
|
+
* ClassicEditor
|
74
|
+
* .create( editorElement, {
|
75
|
+
* simpleUpload: {
|
76
|
+
* withCredentials: true
|
77
|
+
* }
|
78
|
+
* } );
|
79
|
+
* .then( ... )
|
80
|
+
* .catch( ... );
|
81
|
+
* ```
|
82
|
+
*
|
83
|
+
* Learn more about the server application requirements in the
|
84
|
+
* {@glink features/images/image-upload/simple-upload-adapter#server-side-configuration "Server-side configuration"} section
|
85
|
+
* of the feature guide.
|
86
|
+
*
|
87
|
+
* @default false
|
88
|
+
*/
|
89
|
+
withCredentials?: boolean;
|
90
|
+
}
|
package/src/uploadconfig.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 {};
|