@ckeditor/ckeditor5-upload 39.0.1 → 40.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/LICENSE.md +1 -1
  3. package/README.md +3 -3
  4. package/lang/translations/ar.po +1 -0
  5. package/lang/translations/az.po +1 -0
  6. package/lang/translations/bg.po +1 -0
  7. package/lang/translations/bn.po +1 -0
  8. package/lang/translations/ca.po +1 -0
  9. package/lang/translations/cs.po +1 -0
  10. package/lang/translations/da.po +1 -0
  11. package/lang/translations/de-ch.po +1 -0
  12. package/lang/translations/de.po +1 -0
  13. package/lang/translations/el.po +1 -0
  14. package/lang/translations/en-au.po +1 -0
  15. package/lang/translations/en-gb.po +1 -0
  16. package/lang/translations/en.po +1 -0
  17. package/lang/translations/es-co.po +1 -0
  18. package/lang/translations/es.po +1 -0
  19. package/lang/translations/et.po +1 -0
  20. package/lang/translations/fa.po +1 -0
  21. package/lang/translations/fi.po +1 -0
  22. package/lang/translations/fr.po +1 -0
  23. package/lang/translations/gl.po +1 -0
  24. package/lang/translations/he.po +1 -0
  25. package/lang/translations/hi.po +1 -0
  26. package/lang/translations/hr.po +1 -0
  27. package/lang/translations/hu.po +1 -0
  28. package/lang/translations/id.po +1 -0
  29. package/lang/translations/it.po +1 -0
  30. package/lang/translations/ja.po +1 -0
  31. package/lang/translations/ko.po +1 -0
  32. package/lang/translations/ku.po +1 -0
  33. package/lang/translations/lt.po +1 -0
  34. package/lang/translations/lv.po +1 -0
  35. package/lang/translations/ms.po +1 -0
  36. package/lang/translations/nb.po +1 -0
  37. package/lang/translations/ne.po +1 -0
  38. package/lang/translations/nl.po +1 -0
  39. package/lang/translations/no.po +1 -0
  40. package/lang/translations/pl.po +1 -0
  41. package/lang/translations/pt-br.po +1 -0
  42. package/lang/translations/pt.po +1 -0
  43. package/lang/translations/ro.po +1 -0
  44. package/lang/translations/ru.po +1 -0
  45. package/lang/translations/sk.po +1 -0
  46. package/lang/translations/sq.po +1 -0
  47. package/lang/translations/sr-latn.po +1 -0
  48. package/lang/translations/sr.po +1 -0
  49. package/lang/translations/sv.po +1 -0
  50. package/lang/translations/th.po +1 -0
  51. package/lang/translations/tk.po +1 -0
  52. package/lang/translations/tr.po +1 -0
  53. package/lang/translations/ug.po +1 -0
  54. package/lang/translations/uk.po +1 -0
  55. package/lang/translations/ur.po +1 -0
  56. package/lang/translations/uz.po +1 -0
  57. package/lang/translations/vi.po +1 -0
  58. package/lang/translations/zh-cn.po +1 -0
  59. package/lang/translations/zh.po +1 -0
  60. package/package.json +4 -8
  61. package/src/adapters/base64uploadadapter.d.ts +33 -33
  62. package/src/adapters/base64uploadadapter.js +81 -81
  63. package/src/adapters/simpleuploadadapter.d.ts +48 -48
  64. package/src/adapters/simpleuploadadapter.js +175 -175
  65. package/src/augmentation.d.ts +20 -20
  66. package/src/augmentation.js +5 -5
  67. package/src/filereader.d.ts +56 -56
  68. package/src/filereader.js +71 -71
  69. package/src/filerepository.d.ts +342 -342
  70. package/src/filerepository.js +383 -383
  71. package/src/index.d.ts +13 -13
  72. package/src/index.js +12 -12
  73. package/src/ui/filedialogbuttonview.d.ts +84 -84
  74. package/src/ui/filedialogbuttonview.js +108 -108
  75. package/src/uploadconfig.d.ts +90 -90
  76. package/src/uploadconfig.js +5 -5
@@ -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
+ }