@ckeditor/ckeditor5-upload 38.1.1 → 38.2.0-alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +5 -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/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-upload",
|
3
|
-
"version": "38.
|
3
|
+
"version": "38.2.0-alpha.1",
|
4
4
|
"description": "Upload feature for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -10,10 +10,11 @@
|
|
10
10
|
"ckeditor5-dll"
|
11
11
|
],
|
12
12
|
"main": "src/index.js",
|
13
|
+
"type": "module",
|
13
14
|
"dependencies": {
|
14
|
-
"@ckeditor/ckeditor5-core": "38.
|
15
|
-
"@ckeditor/ckeditor5-utils": "38.
|
16
|
-
"@ckeditor/ckeditor5-ui": "38.
|
15
|
+
"@ckeditor/ckeditor5-core": "38.2.0-alpha.1",
|
16
|
+
"@ckeditor/ckeditor5-utils": "38.2.0-alpha.1",
|
17
|
+
"@ckeditor/ckeditor5-ui": "38.2.0-alpha.1"
|
17
18
|
},
|
18
19
|
"engines": {
|
19
20
|
"node": ">=16.0.0",
|
@@ -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.js';
|
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.js';
|
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.js';
|
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
|
+
}
|