@ckeditor/ckeditor5-upload 39.0.1 → 40.0.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 +2 -2
- package/LICENSE.md +1 -1
- package/README.md +3 -3
- package/lang/translations/ar.po +1 -0
- package/lang/translations/az.po +1 -0
- package/lang/translations/bg.po +1 -0
- package/lang/translations/bn.po +1 -0
- package/lang/translations/ca.po +1 -0
- package/lang/translations/cs.po +1 -0
- package/lang/translations/da.po +1 -0
- package/lang/translations/de-ch.po +1 -0
- package/lang/translations/de.po +1 -0
- package/lang/translations/el.po +1 -0
- package/lang/translations/en-au.po +1 -0
- package/lang/translations/en-gb.po +1 -0
- package/lang/translations/en.po +1 -0
- package/lang/translations/es-co.po +1 -0
- package/lang/translations/es.po +1 -0
- package/lang/translations/et.po +1 -0
- package/lang/translations/fa.po +1 -0
- package/lang/translations/fi.po +1 -0
- package/lang/translations/fr.po +1 -0
- package/lang/translations/gl.po +1 -0
- package/lang/translations/he.po +1 -0
- package/lang/translations/hi.po +1 -0
- package/lang/translations/hr.po +1 -0
- package/lang/translations/hu.po +1 -0
- package/lang/translations/id.po +1 -0
- package/lang/translations/it.po +1 -0
- package/lang/translations/ja.po +1 -0
- package/lang/translations/ko.po +1 -0
- package/lang/translations/ku.po +1 -0
- package/lang/translations/lt.po +1 -0
- package/lang/translations/lv.po +1 -0
- package/lang/translations/ms.po +1 -0
- package/lang/translations/nb.po +1 -0
- package/lang/translations/ne.po +1 -0
- package/lang/translations/nl.po +1 -0
- package/lang/translations/no.po +1 -0
- package/lang/translations/pl.po +1 -0
- package/lang/translations/pt-br.po +1 -0
- package/lang/translations/pt.po +1 -0
- package/lang/translations/ro.po +1 -0
- package/lang/translations/ru.po +1 -0
- package/lang/translations/sk.po +1 -0
- package/lang/translations/sq.po +1 -0
- package/lang/translations/sr-latn.po +1 -0
- package/lang/translations/sr.po +1 -0
- package/lang/translations/sv.po +1 -0
- package/lang/translations/th.po +1 -0
- package/lang/translations/tk.po +1 -0
- package/lang/translations/tr.po +1 -0
- package/lang/translations/ug.po +1 -0
- package/lang/translations/uk.po +1 -0
- package/lang/translations/ur.po +1 -0
- package/lang/translations/uz.po +1 -0
- package/lang/translations/vi.po +1 -0
- package/lang/translations/zh-cn.po +1 -0
- package/lang/translations/zh.po +1 -0
- package/package.json +4 -8
- 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 +84 -84
- package/src/ui/filedialogbuttonview.js +108 -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,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, View } 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
|
-
* } );
|
23
|
-
*
|
24
|
-
* view.buttonView.set( {
|
25
|
-
* label: t( 'Insert image' ),
|
26
|
-
* icon: imageIcon,
|
27
|
-
* tooltip: true
|
28
|
-
* } );
|
29
|
-
*
|
30
|
-
* view.on( 'done', ( evt, files ) => {
|
31
|
-
* for ( const file of Array.from( files ) ) {
|
32
|
-
* console.log( 'Selected file', file );
|
33
|
-
* }
|
34
|
-
* } );
|
35
|
-
* ```
|
36
|
-
*/
|
37
|
-
export default class FileDialogButtonView extends View {
|
38
|
-
/**
|
39
|
-
* The button view of the component.
|
40
|
-
*/
|
41
|
-
buttonView: ButtonView;
|
42
|
-
/**
|
43
|
-
* A hidden `<input>` view used to execute file dialog.
|
44
|
-
*/
|
45
|
-
private _fileInputView;
|
46
|
-
/**
|
47
|
-
* Accepted file types. Can be provided in form of file extensions, media type or one of:
|
48
|
-
* * `audio/*`,
|
49
|
-
* * `video/*`,
|
50
|
-
* * `image/*`.
|
51
|
-
*
|
52
|
-
* @observable
|
53
|
-
*/
|
54
|
-
acceptedType: string;
|
55
|
-
/**
|
56
|
-
* Indicates if multiple files can be selected. Defaults to `true`.
|
57
|
-
*
|
58
|
-
* @observable
|
59
|
-
*/
|
60
|
-
allowMultipleFiles: boolean;
|
61
|
-
/**
|
62
|
-
* @inheritDoc
|
63
|
-
*/
|
64
|
-
constructor(locale?: Locale);
|
65
|
-
/**
|
66
|
-
* Focuses the {@link #buttonView}.
|
67
|
-
*/
|
68
|
-
focus(): void;
|
69
|
-
}
|
70
|
-
/**
|
71
|
-
* Fired when file dialog is closed with file selected.
|
72
|
-
*
|
73
|
-
* ```ts
|
74
|
-
* view.on( 'done', ( evt, files ) => {
|
75
|
-
* for ( const file of files ) {
|
76
|
-
* console.log( 'Selected file', file );
|
77
|
-
* }
|
78
|
-
* }
|
79
|
-
* ```
|
80
|
-
*/
|
81
|
-
export type FileInputViewDoneEvent = {
|
82
|
-
name: 'done';
|
83
|
-
args: [files: FileList];
|
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, View } 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
|
+
* } );
|
23
|
+
*
|
24
|
+
* view.buttonView.set( {
|
25
|
+
* label: t( 'Insert image' ),
|
26
|
+
* icon: imageIcon,
|
27
|
+
* tooltip: true
|
28
|
+
* } );
|
29
|
+
*
|
30
|
+
* view.on( 'done', ( evt, files ) => {
|
31
|
+
* for ( const file of Array.from( files ) ) {
|
32
|
+
* console.log( 'Selected file', file );
|
33
|
+
* }
|
34
|
+
* } );
|
35
|
+
* ```
|
36
|
+
*/
|
37
|
+
export default class FileDialogButtonView extends View {
|
38
|
+
/**
|
39
|
+
* The button view of the component.
|
40
|
+
*/
|
41
|
+
buttonView: ButtonView;
|
42
|
+
/**
|
43
|
+
* A hidden `<input>` view used to execute file dialog.
|
44
|
+
*/
|
45
|
+
private _fileInputView;
|
46
|
+
/**
|
47
|
+
* Accepted file types. Can be provided in form of file extensions, media type or one of:
|
48
|
+
* * `audio/*`,
|
49
|
+
* * `video/*`,
|
50
|
+
* * `image/*`.
|
51
|
+
*
|
52
|
+
* @observable
|
53
|
+
*/
|
54
|
+
acceptedType: string;
|
55
|
+
/**
|
56
|
+
* Indicates if multiple files can be selected. Defaults to `true`.
|
57
|
+
*
|
58
|
+
* @observable
|
59
|
+
*/
|
60
|
+
allowMultipleFiles: boolean;
|
61
|
+
/**
|
62
|
+
* @inheritDoc
|
63
|
+
*/
|
64
|
+
constructor(locale?: Locale);
|
65
|
+
/**
|
66
|
+
* Focuses the {@link #buttonView}.
|
67
|
+
*/
|
68
|
+
focus(): void;
|
69
|
+
}
|
70
|
+
/**
|
71
|
+
* Fired when file dialog is closed with file selected.
|
72
|
+
*
|
73
|
+
* ```ts
|
74
|
+
* view.on( 'done', ( evt, files ) => {
|
75
|
+
* for ( const file of files ) {
|
76
|
+
* console.log( 'Selected file', file );
|
77
|
+
* }
|
78
|
+
* }
|
79
|
+
* ```
|
80
|
+
*/
|
81
|
+
export type FileInputViewDoneEvent = {
|
82
|
+
name: 'done';
|
83
|
+
args: [files: FileList];
|
84
|
+
};
|
@@ -1,108 +1,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
|
-
* } );
|
22
|
-
*
|
23
|
-
* view.buttonView.set( {
|
24
|
-
* label: t( 'Insert image' ),
|
25
|
-
* icon: imageIcon,
|
26
|
-
* tooltip: true
|
27
|
-
* } );
|
28
|
-
*
|
29
|
-
* view.on( 'done', ( evt, files ) => {
|
30
|
-
* for ( const file of Array.from( files ) ) {
|
31
|
-
* console.log( 'Selected file', file );
|
32
|
-
* }
|
33
|
-
* } );
|
34
|
-
* ```
|
35
|
-
*/
|
36
|
-
export default class FileDialogButtonView extends View {
|
37
|
-
/**
|
38
|
-
* @inheritDoc
|
39
|
-
*/
|
40
|
-
constructor(locale) {
|
41
|
-
super(locale);
|
42
|
-
this.buttonView = new ButtonView(locale);
|
43
|
-
this._fileInputView = new FileInputView(locale);
|
44
|
-
this._fileInputView.bind('acceptedType').to(this);
|
45
|
-
this._fileInputView.bind('allowMultipleFiles').to(this);
|
46
|
-
this._fileInputView.delegate('done').to(this);
|
47
|
-
this.setTemplate({
|
48
|
-
tag: 'span',
|
49
|
-
attributes: {
|
50
|
-
class: 'ck-file-dialog-button'
|
51
|
-
},
|
52
|
-
children: [
|
53
|
-
this.buttonView,
|
54
|
-
this._fileInputView
|
55
|
-
]
|
56
|
-
});
|
57
|
-
this.buttonView.on('execute', () => {
|
58
|
-
this._fileInputView.open();
|
59
|
-
});
|
60
|
-
}
|
61
|
-
/**
|
62
|
-
* Focuses the {@link #buttonView}.
|
63
|
-
*/
|
64
|
-
focus() {
|
65
|
-
this.buttonView.focus();
|
66
|
-
}
|
67
|
-
}
|
68
|
-
/**
|
69
|
-
* The hidden file input view class.
|
70
|
-
*/
|
71
|
-
class FileInputView extends View {
|
72
|
-
/**
|
73
|
-
* @inheritDoc
|
74
|
-
*/
|
75
|
-
constructor(locale) {
|
76
|
-
super(locale);
|
77
|
-
this.set('acceptedType', undefined);
|
78
|
-
this.set('allowMultipleFiles', false);
|
79
|
-
const bind = this.bindTemplate;
|
80
|
-
this.setTemplate({
|
81
|
-
tag: 'input',
|
82
|
-
attributes: {
|
83
|
-
class: [
|
84
|
-
'ck-hidden'
|
85
|
-
],
|
86
|
-
type: 'file',
|
87
|
-
tabindex: '-1',
|
88
|
-
accept: bind.to('acceptedType'),
|
89
|
-
multiple: bind.to('allowMultipleFiles')
|
90
|
-
},
|
91
|
-
on: {
|
92
|
-
// Removing from code coverage since we cannot programmatically set input element files.
|
93
|
-
change: bind.to(/* istanbul ignore next -- @preserve */ () => {
|
94
|
-
if (this.element && this.element.files && this.element.files.length) {
|
95
|
-
this.fire('done', this.element.files);
|
96
|
-
}
|
97
|
-
this.element.value = '';
|
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
|
+
* } );
|
22
|
+
*
|
23
|
+
* view.buttonView.set( {
|
24
|
+
* label: t( 'Insert image' ),
|
25
|
+
* icon: imageIcon,
|
26
|
+
* tooltip: true
|
27
|
+
* } );
|
28
|
+
*
|
29
|
+
* view.on( 'done', ( evt, files ) => {
|
30
|
+
* for ( const file of Array.from( files ) ) {
|
31
|
+
* console.log( 'Selected file', file );
|
32
|
+
* }
|
33
|
+
* } );
|
34
|
+
* ```
|
35
|
+
*/
|
36
|
+
export default class FileDialogButtonView extends View {
|
37
|
+
/**
|
38
|
+
* @inheritDoc
|
39
|
+
*/
|
40
|
+
constructor(locale) {
|
41
|
+
super(locale);
|
42
|
+
this.buttonView = new ButtonView(locale);
|
43
|
+
this._fileInputView = new FileInputView(locale);
|
44
|
+
this._fileInputView.bind('acceptedType').to(this);
|
45
|
+
this._fileInputView.bind('allowMultipleFiles').to(this);
|
46
|
+
this._fileInputView.delegate('done').to(this);
|
47
|
+
this.setTemplate({
|
48
|
+
tag: 'span',
|
49
|
+
attributes: {
|
50
|
+
class: 'ck-file-dialog-button'
|
51
|
+
},
|
52
|
+
children: [
|
53
|
+
this.buttonView,
|
54
|
+
this._fileInputView
|
55
|
+
]
|
56
|
+
});
|
57
|
+
this.buttonView.on('execute', () => {
|
58
|
+
this._fileInputView.open();
|
59
|
+
});
|
60
|
+
}
|
61
|
+
/**
|
62
|
+
* Focuses the {@link #buttonView}.
|
63
|
+
*/
|
64
|
+
focus() {
|
65
|
+
this.buttonView.focus();
|
66
|
+
}
|
67
|
+
}
|
68
|
+
/**
|
69
|
+
* The hidden file input view class.
|
70
|
+
*/
|
71
|
+
class FileInputView extends View {
|
72
|
+
/**
|
73
|
+
* @inheritDoc
|
74
|
+
*/
|
75
|
+
constructor(locale) {
|
76
|
+
super(locale);
|
77
|
+
this.set('acceptedType', undefined);
|
78
|
+
this.set('allowMultipleFiles', false);
|
79
|
+
const bind = this.bindTemplate;
|
80
|
+
this.setTemplate({
|
81
|
+
tag: 'input',
|
82
|
+
attributes: {
|
83
|
+
class: [
|
84
|
+
'ck-hidden'
|
85
|
+
],
|
86
|
+
type: 'file',
|
87
|
+
tabindex: '-1',
|
88
|
+
accept: bind.to('acceptedType'),
|
89
|
+
multiple: bind.to('allowMultipleFiles')
|
90
|
+
},
|
91
|
+
on: {
|
92
|
+
// Removing from code coverage since we cannot programmatically set input element files.
|
93
|
+
change: bind.to(/* istanbul ignore next -- @preserve */ () => {
|
94
|
+
if (this.element && this.element.files && this.element.files.length) {
|
95
|
+
this.fire('done', this.element.files);
|
96
|
+
}
|
97
|
+
this.element.value = '';
|
98
|
+
})
|
99
|
+
}
|
100
|
+
});
|
101
|
+
}
|
102
|
+
/**
|
103
|
+
* Opens file dialog.
|
104
|
+
*/
|
105
|
+
open() {
|
106
|
+
this.element.click();
|
107
|
+
}
|
108
|
+
}
|
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 {};
|