@ckeditor/ckeditor5-upload 38.0.1 → 38.1.1

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-upload",
3
- "version": "38.0.1",
3
+ "version": "38.1.1",
4
4
  "description": "Upload feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -11,14 +11,9 @@
11
11
  ],
12
12
  "main": "src/index.js",
13
13
  "dependencies": {
14
- "@ckeditor/ckeditor5-core": "^38.0.1",
15
- "@ckeditor/ckeditor5-utils": "^38.0.1",
16
- "@ckeditor/ckeditor5-ui": "^38.0.1"
17
- },
18
- "devDependencies": {
19
- "typescript": "^4.8.4",
20
- "webpack": "^5.58.1",
21
- "webpack-cli": "^4.9.0"
14
+ "@ckeditor/ckeditor5-core": "38.1.1",
15
+ "@ckeditor/ckeditor5-utils": "38.1.1",
16
+ "@ckeditor/ckeditor5-ui": "38.1.1"
22
17
  },
23
18
  "engines": {
24
19
  "node": ">=16.0.0",
@@ -41,9 +36,5 @@
41
36
  "ckeditor5-metadata.json",
42
37
  "CHANGELOG.md"
43
38
  ],
44
- "scripts": {
45
- "build": "tsc -p ./tsconfig.json",
46
- "postversion": "npm run build"
47
- },
48
39
  "types": "src/index.d.ts"
49
40
  }
@@ -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
+ }