@ckeditor/ckeditor5-upload 40.0.0 → 40.1.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/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 +84 -84
- package/src/ui/filedialogbuttonview.js +108 -108
- package/src/uploadconfig.d.ts +90 -90
- package/src/uploadconfig.js +5 -5
package/LICENSE.md
CHANGED
@@ -2,7 +2,7 @@ Software License Agreement
|
|
2
2
|
==========================
|
3
3
|
|
4
4
|
**CKEditor 5 upload feature** – https://github.com/ckeditor/ckeditor5-upload <br>
|
5
|
-
Copyright (c) 2003
|
5
|
+
Copyright (c) 2003–2023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
|
6
6
|
|
7
7
|
Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
|
8
8
|
|
@@ -14,4 +14,4 @@ Where not otherwise indicated, all CKEditor content is authored by CKSource engi
|
|
14
14
|
Trademarks
|
15
15
|
----------
|
16
16
|
|
17
|
-
**CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
|
17
|
+
**CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks, or service marks of their respective holders.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-upload",
|
3
|
-
"version": "40.
|
3
|
+
"version": "40.1.0",
|
4
4
|
"description": "Upload feature for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -11,9 +11,9 @@
|
|
11
11
|
],
|
12
12
|
"main": "src/index.js",
|
13
13
|
"dependencies": {
|
14
|
-
"@ckeditor/ckeditor5-core": "40.
|
15
|
-
"@ckeditor/ckeditor5-utils": "40.
|
16
|
-
"@ckeditor/ckeditor5-ui": "40.
|
14
|
+
"@ckeditor/ckeditor5-core": "40.1.0",
|
15
|
+
"@ckeditor/ckeditor5-utils": "40.1.0",
|
16
|
+
"@ckeditor/ckeditor5-ui": "40.1.0"
|
17
17
|
},
|
18
18
|
"author": "CKSource (http://cksource.com/)",
|
19
19
|
"license": "GPL-2.0-or-later",
|
@@ -1,33 +1,33 @@
|
|
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/adapters/base64uploadadapter
|
7
|
-
*/
|
8
|
-
import { Plugin } from '@ckeditor/ckeditor5-core';
|
9
|
-
import FileRepository from '../filerepository';
|
10
|
-
/**
|
11
|
-
* A plugin that converts images inserted into the editor into [Base64 strings](https://en.wikipedia.org/wiki/Base64)
|
12
|
-
* in the {@glink installation/getting-started/getting-and-setting-data editor output}.
|
13
|
-
*
|
14
|
-
* This kind of image upload does not require server processing – images are stored with the rest of the text and
|
15
|
-
* displayed by the web browser without additional requests.
|
16
|
-
*
|
17
|
-
* Check out the {@glink features/images/image-upload/image-upload comprehensive "Image upload overview"} to learn about
|
18
|
-
* other ways to upload images into CKEditor 5.
|
19
|
-
*/
|
20
|
-
export default class Base64UploadAdapter extends Plugin {
|
21
|
-
/**
|
22
|
-
* @inheritDoc
|
23
|
-
*/
|
24
|
-
static get requires(): readonly [typeof FileRepository];
|
25
|
-
/**
|
26
|
-
* @inheritDoc
|
27
|
-
*/
|
28
|
-
static get pluginName(): "Base64UploadAdapter";
|
29
|
-
/**
|
30
|
-
* @inheritDoc
|
31
|
-
*/
|
32
|
-
init(): void;
|
33
|
-
}
|
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/adapters/base64uploadadapter
|
7
|
+
*/
|
8
|
+
import { Plugin } from '@ckeditor/ckeditor5-core';
|
9
|
+
import FileRepository from '../filerepository';
|
10
|
+
/**
|
11
|
+
* A plugin that converts images inserted into the editor into [Base64 strings](https://en.wikipedia.org/wiki/Base64)
|
12
|
+
* in the {@glink installation/getting-started/getting-and-setting-data editor output}.
|
13
|
+
*
|
14
|
+
* This kind of image upload does not require server processing – images are stored with the rest of the text and
|
15
|
+
* displayed by the web browser without additional requests.
|
16
|
+
*
|
17
|
+
* Check out the {@glink features/images/image-upload/image-upload comprehensive "Image upload overview"} to learn about
|
18
|
+
* other ways to upload images into CKEditor 5.
|
19
|
+
*/
|
20
|
+
export default class Base64UploadAdapter extends Plugin {
|
21
|
+
/**
|
22
|
+
* @inheritDoc
|
23
|
+
*/
|
24
|
+
static get requires(): readonly [typeof FileRepository];
|
25
|
+
/**
|
26
|
+
* @inheritDoc
|
27
|
+
*/
|
28
|
+
static get pluginName(): "Base64UploadAdapter";
|
29
|
+
/**
|
30
|
+
* @inheritDoc
|
31
|
+
*/
|
32
|
+
init(): void;
|
33
|
+
}
|
@@ -1,81 +1,81 @@
|
|
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/adapters/base64uploadadapter
|
7
|
-
*/
|
8
|
-
/* globals window */
|
9
|
-
import { Plugin } from '@ckeditor/ckeditor5-core';
|
10
|
-
import FileRepository from '../filerepository';
|
11
|
-
/**
|
12
|
-
* A plugin that converts images inserted into the editor into [Base64 strings](https://en.wikipedia.org/wiki/Base64)
|
13
|
-
* in the {@glink installation/getting-started/getting-and-setting-data editor output}.
|
14
|
-
*
|
15
|
-
* This kind of image upload does not require server processing – images are stored with the rest of the text and
|
16
|
-
* displayed by the web browser without additional requests.
|
17
|
-
*
|
18
|
-
* Check out the {@glink features/images/image-upload/image-upload comprehensive "Image upload overview"} to learn about
|
19
|
-
* other ways to upload images into CKEditor 5.
|
20
|
-
*/
|
21
|
-
export default class Base64UploadAdapter extends Plugin {
|
22
|
-
/**
|
23
|
-
* @inheritDoc
|
24
|
-
*/
|
25
|
-
static get requires() {
|
26
|
-
return [FileRepository];
|
27
|
-
}
|
28
|
-
/**
|
29
|
-
* @inheritDoc
|
30
|
-
*/
|
31
|
-
static get pluginName() {
|
32
|
-
return 'Base64UploadAdapter';
|
33
|
-
}
|
34
|
-
/**
|
35
|
-
* @inheritDoc
|
36
|
-
*/
|
37
|
-
init() {
|
38
|
-
this.editor.plugins.get(FileRepository).createUploadAdapter = loader => new Adapter(loader);
|
39
|
-
}
|
40
|
-
}
|
41
|
-
/**
|
42
|
-
* The upload adapter that converts images inserted into the editor into Base64 strings.
|
43
|
-
*/
|
44
|
-
class Adapter {
|
45
|
-
/**
|
46
|
-
* Creates a new adapter instance.
|
47
|
-
*/
|
48
|
-
constructor(loader) {
|
49
|
-
this.loader = loader;
|
50
|
-
}
|
51
|
-
/**
|
52
|
-
* Starts the upload process.
|
53
|
-
*
|
54
|
-
* @see module:upload/filerepository~UploadAdapter#upload
|
55
|
-
*/
|
56
|
-
upload() {
|
57
|
-
return new Promise((resolve, reject) => {
|
58
|
-
const reader = this.reader = new window.FileReader();
|
59
|
-
reader.addEventListener('load', () => {
|
60
|
-
resolve({ default: reader.result });
|
61
|
-
});
|
62
|
-
reader.addEventListener('error', err => {
|
63
|
-
reject(err);
|
64
|
-
});
|
65
|
-
reader.addEventListener('abort', () => {
|
66
|
-
reject();
|
67
|
-
});
|
68
|
-
this.loader.file.then(file => {
|
69
|
-
reader.readAsDataURL(file);
|
70
|
-
});
|
71
|
-
});
|
72
|
-
}
|
73
|
-
/**
|
74
|
-
* Aborts the upload process.
|
75
|
-
*
|
76
|
-
* @see module:upload/filerepository~UploadAdapter#abort
|
77
|
-
*/
|
78
|
-
abort() {
|
79
|
-
this.reader.abort();
|
80
|
-
}
|
81
|
-
}
|
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/adapters/base64uploadadapter
|
7
|
+
*/
|
8
|
+
/* globals window */
|
9
|
+
import { Plugin } from '@ckeditor/ckeditor5-core';
|
10
|
+
import FileRepository from '../filerepository';
|
11
|
+
/**
|
12
|
+
* A plugin that converts images inserted into the editor into [Base64 strings](https://en.wikipedia.org/wiki/Base64)
|
13
|
+
* in the {@glink installation/getting-started/getting-and-setting-data editor output}.
|
14
|
+
*
|
15
|
+
* This kind of image upload does not require server processing – images are stored with the rest of the text and
|
16
|
+
* displayed by the web browser without additional requests.
|
17
|
+
*
|
18
|
+
* Check out the {@glink features/images/image-upload/image-upload comprehensive "Image upload overview"} to learn about
|
19
|
+
* other ways to upload images into CKEditor 5.
|
20
|
+
*/
|
21
|
+
export default class Base64UploadAdapter extends Plugin {
|
22
|
+
/**
|
23
|
+
* @inheritDoc
|
24
|
+
*/
|
25
|
+
static get requires() {
|
26
|
+
return [FileRepository];
|
27
|
+
}
|
28
|
+
/**
|
29
|
+
* @inheritDoc
|
30
|
+
*/
|
31
|
+
static get pluginName() {
|
32
|
+
return 'Base64UploadAdapter';
|
33
|
+
}
|
34
|
+
/**
|
35
|
+
* @inheritDoc
|
36
|
+
*/
|
37
|
+
init() {
|
38
|
+
this.editor.plugins.get(FileRepository).createUploadAdapter = loader => new Adapter(loader);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
/**
|
42
|
+
* The upload adapter that converts images inserted into the editor into Base64 strings.
|
43
|
+
*/
|
44
|
+
class Adapter {
|
45
|
+
/**
|
46
|
+
* Creates a new adapter instance.
|
47
|
+
*/
|
48
|
+
constructor(loader) {
|
49
|
+
this.loader = loader;
|
50
|
+
}
|
51
|
+
/**
|
52
|
+
* Starts the upload process.
|
53
|
+
*
|
54
|
+
* @see module:upload/filerepository~UploadAdapter#upload
|
55
|
+
*/
|
56
|
+
upload() {
|
57
|
+
return new Promise((resolve, reject) => {
|
58
|
+
const reader = this.reader = new window.FileReader();
|
59
|
+
reader.addEventListener('load', () => {
|
60
|
+
resolve({ default: reader.result });
|
61
|
+
});
|
62
|
+
reader.addEventListener('error', err => {
|
63
|
+
reject(err);
|
64
|
+
});
|
65
|
+
reader.addEventListener('abort', () => {
|
66
|
+
reject();
|
67
|
+
});
|
68
|
+
this.loader.file.then(file => {
|
69
|
+
reader.readAsDataURL(file);
|
70
|
+
});
|
71
|
+
});
|
72
|
+
}
|
73
|
+
/**
|
74
|
+
* Aborts the upload process.
|
75
|
+
*
|
76
|
+
* @see module:upload/filerepository~UploadAdapter#abort
|
77
|
+
*/
|
78
|
+
abort() {
|
79
|
+
this.reader.abort();
|
80
|
+
}
|
81
|
+
}
|
@@ -1,48 +1,48 @@
|
|
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/adapters/simpleuploadadapter
|
7
|
-
*/
|
8
|
-
import { Plugin } from '@ckeditor/ckeditor5-core';
|
9
|
-
import FileRepository from '../filerepository';
|
10
|
-
/**
|
11
|
-
* The Simple upload adapter allows uploading images to an application running on your server using
|
12
|
-
* the [`XMLHttpRequest`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) API with a
|
13
|
-
* minimal {@link module:upload/uploadconfig~SimpleUploadConfig editor configuration}.
|
14
|
-
*
|
15
|
-
* ```ts
|
16
|
-
* ClassicEditor
|
17
|
-
* .create( document.querySelector( '#editor' ), {
|
18
|
-
* simpleUpload: {
|
19
|
-
* uploadUrl: 'http://example.com',
|
20
|
-
* headers: {
|
21
|
-
* ...
|
22
|
-
* }
|
23
|
-
* }
|
24
|
-
* } )
|
25
|
-
* .then( ... )
|
26
|
-
* .catch( ... );
|
27
|
-
* ```
|
28
|
-
*
|
29
|
-
* See the {@glink features/images/image-upload/simple-upload-adapter "Simple upload adapter"} guide to learn how to
|
30
|
-
* learn more about the feature (configuration, server–side requirements, etc.).
|
31
|
-
*
|
32
|
-
* Check out the {@glink features/images/image-upload/image-upload comprehensive "Image upload overview"} to learn about
|
33
|
-
* other ways to upload images into CKEditor 5.
|
34
|
-
*/
|
35
|
-
export default class SimpleUploadAdapter extends Plugin {
|
36
|
-
/**
|
37
|
-
* @inheritDoc
|
38
|
-
*/
|
39
|
-
static get requires(): readonly [typeof FileRepository];
|
40
|
-
/**
|
41
|
-
* @inheritDoc
|
42
|
-
*/
|
43
|
-
static get pluginName(): "SimpleUploadAdapter";
|
44
|
-
/**
|
45
|
-
* @inheritDoc
|
46
|
-
*/
|
47
|
-
init(): void;
|
48
|
-
}
|
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/adapters/simpleuploadadapter
|
7
|
+
*/
|
8
|
+
import { Plugin } from '@ckeditor/ckeditor5-core';
|
9
|
+
import FileRepository from '../filerepository';
|
10
|
+
/**
|
11
|
+
* The Simple upload adapter allows uploading images to an application running on your server using
|
12
|
+
* the [`XMLHttpRequest`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) API with a
|
13
|
+
* minimal {@link module:upload/uploadconfig~SimpleUploadConfig editor configuration}.
|
14
|
+
*
|
15
|
+
* ```ts
|
16
|
+
* ClassicEditor
|
17
|
+
* .create( document.querySelector( '#editor' ), {
|
18
|
+
* simpleUpload: {
|
19
|
+
* uploadUrl: 'http://example.com',
|
20
|
+
* headers: {
|
21
|
+
* ...
|
22
|
+
* }
|
23
|
+
* }
|
24
|
+
* } )
|
25
|
+
* .then( ... )
|
26
|
+
* .catch( ... );
|
27
|
+
* ```
|
28
|
+
*
|
29
|
+
* See the {@glink features/images/image-upload/simple-upload-adapter "Simple upload adapter"} guide to learn how to
|
30
|
+
* learn more about the feature (configuration, server–side requirements, etc.).
|
31
|
+
*
|
32
|
+
* Check out the {@glink features/images/image-upload/image-upload comprehensive "Image upload overview"} to learn about
|
33
|
+
* other ways to upload images into CKEditor 5.
|
34
|
+
*/
|
35
|
+
export default class SimpleUploadAdapter extends Plugin {
|
36
|
+
/**
|
37
|
+
* @inheritDoc
|
38
|
+
*/
|
39
|
+
static get requires(): readonly [typeof FileRepository];
|
40
|
+
/**
|
41
|
+
* @inheritDoc
|
42
|
+
*/
|
43
|
+
static get pluginName(): "SimpleUploadAdapter";
|
44
|
+
/**
|
45
|
+
* @inheritDoc
|
46
|
+
*/
|
47
|
+
init(): void;
|
48
|
+
}
|