@ckeditor/ckeditor5-upload 0.0.0-nightly-20240401.0 → 0.0.0-nightly-20240403.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-upload",
3
- "version": "0.0.0-nightly-20240401.0",
3
+ "version": "0.0.0-nightly-20240403.0",
4
4
  "description": "Upload feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -12,9 +12,8 @@
12
12
  "type": "module",
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "@ckeditor/ckeditor5-core": "0.0.0-nightly-20240401.0",
16
- "@ckeditor/ckeditor5-utils": "0.0.0-nightly-20240401.0",
17
- "@ckeditor/ckeditor5-ui": "0.0.0-nightly-20240401.0"
15
+ "@ckeditor/ckeditor5-core": "0.0.0-nightly-20240403.0",
16
+ "@ckeditor/ckeditor5-utils": "0.0.0-nightly-20240403.0"
18
17
  },
19
18
  "author": "CKSource (http://cksource.com/)",
20
19
  "license": "GPL-2.0-or-later",
package/src/index.d.ts CHANGED
@@ -6,8 +6,8 @@
6
6
  * @module upload
7
7
  */
8
8
  export { default as FileRepository, type UploadAdapter, type UploadResponse, type FileLoader } from './filerepository.js';
9
- export { default as FileDialogButtonView } from './ui/filedialogbuttonview.js';
10
9
  export { default as Base64UploadAdapter } from './adapters/base64uploadadapter.js';
11
10
  export { default as SimpleUploadAdapter } from './adapters/simpleuploadadapter.js';
12
11
  export type { SimpleUploadConfig } from './uploadconfig.js';
12
+ export { FileDialogButtonView } from '@ckeditor/ckeditor5-ui';
13
13
  import './augmentation.js';
package/src/index.js CHANGED
@@ -6,7 +6,8 @@
6
6
  * @module upload
7
7
  */
8
8
  export { default as FileRepository } from './filerepository.js';
9
- export { default as FileDialogButtonView } from './ui/filedialogbuttonview.js';
10
9
  export { default as Base64UploadAdapter } from './adapters/base64uploadadapter.js';
11
10
  export { default as SimpleUploadAdapter } from './adapters/simpleuploadadapter.js';
11
+ // Backward compatibility for DLLs.
12
+ export { FileDialogButtonView } from '@ckeditor/ckeditor5-ui';
12
13
  import './augmentation.js';
@@ -1,83 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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,102 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- }