@ckeditor/ckeditor5-easy-image 39.0.2 → 40.0.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/build/easy-image.js.map +1 -0
- package/package.json +2 -2
- package/src/augmentation.d.ts +11 -11
- package/src/augmentation.js +5 -5
- package/src/cloudservicesuploadadapter.d.ts +32 -32
- package/src/cloudservicesuploadadapter.js +67 -67
- package/src/easyimage.d.ts +47 -47
- package/src/easyimage.js +69 -69
- package/src/index.d.ts +10 -10
- package/src/index.js +10 -10
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"easy-image.js","mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE4C;AACU;;AAEtD;AACA;AACA;AACA,6BAA6B,6CAA6C;AAC1E;AACA;AACA,IAAI,qFAAqF;AACzF;AACA;AACA;AACe,yCAAyC,sDAAM;AAC9D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4BAA4B,gEAAc;AAC1C;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,sBAAsB,gEAAc;AACpC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;ACtFA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE4C;AACK;;AAEqB;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,8EAA8E;AACpF;AACA;AACA;AACA,MAAM,+BAA+B;AACrC,MAAM,2CAA2C;AACjD;AACA,YAAY,+EAA+E;AAC3F;AACA;AACA,kBAAkB,qFAAqF;AACvG;AACA;AACA;AACA;AACA,wBAAwB,qFAAqF;AAC7G;AACA;AACA;AACe,wBAAwB,sDAAM;AAC7C;AACA;AACA;AACA;AACA,WAAW,mEAA0B;AACrC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS,yCAAyC;AAClD,SAAS,2CAA2C;AACpD,SAAS,gCAAgC;AACzC;AACA;AACA;AACA;AACA,cAAc,kCAAkC;AAChD;AACA,GAAG,+DAAU;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;AC7EA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;;;ACNA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEmD;AACkC","sources":["webpack://CKEditor5.easyImage/./src/cloudservicesuploadadapter.js","webpack://CKEditor5.easyImage/./src/easyimage.js","webpack://CKEditor5.easyImage/delegated \"./src/core.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.easyImage/delegated \"./src/upload.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.easyImage/delegated \"./src/utils.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.easyImage/external var \"CKEditor5.dll\"","webpack://CKEditor5.easyImage/webpack/bootstrap","webpack://CKEditor5.easyImage/webpack/runtime/define property getters","webpack://CKEditor5.easyImage/webpack/runtime/hasOwnProperty shorthand","webpack://CKEditor5.easyImage/webpack/runtime/make namespace object","webpack://CKEditor5.easyImage/./src/index.js"],"sourcesContent":["/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n* @module easy-image/cloudservicesuploadadapter\n*/\n\nimport { Plugin } from 'ckeditor5/src/core';\nimport { FileRepository } from 'ckeditor5/src/upload';\n\n/**\n * A plugin that enables upload to [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/).\n *\n * It is mainly used by the {@link module:easy-image/easyimage~EasyImage} feature.\n *\n * After enabling this adapter you need to configure the CKEditor Cloud Services integration through\n * {@link module:cloud-services/cloudservices~CloudServicesConfig `config.cloudServices`}.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class CloudServicesUploadAdapter extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'CloudServicesUploadAdapter';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ 'CloudServices', FileRepository ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\n\t\tconst editor = this.editor;\n\n\t\tconst cloudServices = editor.plugins.get( 'CloudServices' );\n\n\t\tconst token = cloudServices.token;\n\t\tconst uploadUrl = cloudServices.uploadUrl;\n\n\t\tif ( !token ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._uploadGateway = editor.plugins.get( 'CloudServicesCore' ).createUploadGateway( token, uploadUrl );\n\n\t\teditor.plugins.get( FileRepository ).createUploadAdapter = loader => {\n\t\t\treturn new Adapter( this._uploadGateway, loader );\n\t\t};\n\t}\n}\n\n/**\n * @private\n */\nclass Adapter {\n\tconstructor( uploadGateway, loader ) {\n\t\tthis.uploadGateway = uploadGateway;\n\n\t\tthis.loader = loader;\n\t}\n\n\tupload() {\n\t\treturn this.loader.file.then( file => {\n\t\t\tthis.fileUploader = this.uploadGateway.upload( file );\n\n\t\t\tthis.fileUploader.on( 'progress', ( evt, data ) => {\n\t\t\t\tthis.loader.uploadTotal = data.total;\n\t\t\t\tthis.loader.uploaded = data.uploaded;\n\t\t\t} );\n\n\t\t\treturn this.fileUploader.send();\n\t\t} );\n\t}\n\n\tabort() {\n\t\tthis.fileUploader.abort();\n\t}\n}\n\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module easy-image/easyimage\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\nimport { logWarning } from 'ckeditor5/src/utils';\n\nimport CloudServicesUploadAdapter from './cloudservicesuploadadapter';\n\n/**\n * The Easy Image feature, which makes the image upload in CKEditor 5 possible with virtually zero\n * server setup. A part of the [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)\n * family.\n *\n * This is a \"glue\" plugin which enables:\n *\n * * {@link module:easy-image/cloudservicesuploadadapter~CloudServicesUploadAdapter}.\n *\n * This plugin requires plugin to be present in the editor configuration:\n *\n * * {@link module:image/image~Image},\n * * {@link module:image/imageupload~ImageUpload},\n *\n * See the {@glink features/images/image-upload/easy-image \"Easy Image integration\" guide} to learn how to configure\n * and use this feature.\n *\n * Check out the {@glink features/images/image-upload/image-upload comprehensive \"Image upload\" guide} to learn about\n * other ways to upload images into CKEditor 5.\n *\n * **Note**: After enabling the Easy Image plugin you need to configure the\n * [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)\n * integration through {@link module:cloud-services/cloudservices~CloudServicesConfig `config.cloudServices`}.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class EasyImage extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ CloudServicesUploadAdapter, 'ImageUpload' ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\n\t\tconst editor = this.editor;\n\n\t\tif ( !editor.plugins.has( 'ImageBlockEditing' ) && !editor.plugins.has( 'ImageInlineEditing' ) ) {\n\t\t\t/**\n\t\t\t * The Easy Image feature requires one of the following plugins to be loaded to work correctly:\n\t\t\t *\n\t\t\t * * {@link module:image/imageblock~ImageBlock},\n\t\t\t * * {@link module:image/imageinline~ImageInline},\n\t\t\t * * {@link module:image/image~Image} (loads both `ImageBlock` and `ImageInline`)\n\t\t\t *\n\t\t\t * Please make sure your editor configuration is correct.\n\t\t\t *\n\t\t\t * @error easy-image-image-feature-missing\n\t\t\t * @param {module:core/editor/editor~Editor} editor\n\t\t\t */\n\t\t\tlogWarning( 'easy-image-image-feature-missing', editor );\n\t\t}\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'EasyImage';\n\t}\n}\n","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/core.js\");","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/upload.js\");","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/utils.js\");","module.exports = CKEditor5.dll;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module easy-image\n */\n\nexport { default as EasyImage } from './easyimage';\nexport { default as CloudServicesUploadAdapter } from './cloudservicesuploadadapter';\n"],"names":[],"sourceRoot":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-easy-image",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "40.0.0",
|
|
4
4
|
"description": "Easy Image feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
],
|
|
13
13
|
"main": "src/index.js",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"ckeditor5": "
|
|
15
|
+
"ckeditor5": "40.0.0"
|
|
16
16
|
},
|
|
17
17
|
"author": "CKSource (http://cksource.com/)",
|
|
18
18
|
"license": "GPL-2.0-or-later",
|
package/src/augmentation.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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
|
-
import type { EasyImage, CloudServicesUploadAdapter } from './index';
|
|
6
|
-
declare module '@ckeditor/ckeditor5-core' {
|
|
7
|
-
interface PluginsMap {
|
|
8
|
-
[EasyImage.pluginName]: EasyImage;
|
|
9
|
-
[CloudServicesUploadAdapter.pluginName]: CloudServicesUploadAdapter;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
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
|
+
import type { EasyImage, CloudServicesUploadAdapter } from './index';
|
|
6
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
7
|
+
interface PluginsMap {
|
|
8
|
+
[EasyImage.pluginName]: EasyImage;
|
|
9
|
+
[CloudServicesUploadAdapter.pluginName]: CloudServicesUploadAdapter;
|
|
10
|
+
}
|
|
11
|
+
}
|
package/src/augmentation.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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
|
-
export {};
|
|
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
|
+
export {};
|
|
@@ -1,32 +1,32 @@
|
|
|
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 easy-image/cloudservicesuploadadapter
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import { FileRepository } from 'ckeditor5/src/upload';
|
|
10
|
-
/**
|
|
11
|
-
* A plugin that enables upload to [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/).
|
|
12
|
-
*
|
|
13
|
-
* It is mainly used by the {@link module:easy-image/easyimage~EasyImage} feature.
|
|
14
|
-
*
|
|
15
|
-
* After enabling this adapter you need to configure the CKEditor Cloud Services integration through
|
|
16
|
-
* {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudServices`}.
|
|
17
|
-
*/
|
|
18
|
-
export default class CloudServicesUploadAdapter extends Plugin {
|
|
19
|
-
private _uploadGateway?;
|
|
20
|
-
/**
|
|
21
|
-
* @inheritDoc
|
|
22
|
-
*/
|
|
23
|
-
static get pluginName(): "CloudServicesUploadAdapter";
|
|
24
|
-
/**
|
|
25
|
-
* @inheritDoc
|
|
26
|
-
*/
|
|
27
|
-
static get requires(): readonly ["CloudServices", typeof FileRepository];
|
|
28
|
-
/**
|
|
29
|
-
* @inheritDoc
|
|
30
|
-
*/
|
|
31
|
-
init(): void;
|
|
32
|
-
}
|
|
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 easy-image/cloudservicesuploadadapter
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
+
import { FileRepository } from 'ckeditor5/src/upload';
|
|
10
|
+
/**
|
|
11
|
+
* A plugin that enables upload to [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/).
|
|
12
|
+
*
|
|
13
|
+
* It is mainly used by the {@link module:easy-image/easyimage~EasyImage} feature.
|
|
14
|
+
*
|
|
15
|
+
* After enabling this adapter you need to configure the CKEditor Cloud Services integration through
|
|
16
|
+
* {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudServices`}.
|
|
17
|
+
*/
|
|
18
|
+
export default class CloudServicesUploadAdapter extends Plugin {
|
|
19
|
+
private _uploadGateway?;
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
static get pluginName(): "CloudServicesUploadAdapter";
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
static get requires(): readonly ["CloudServices", typeof FileRepository];
|
|
28
|
+
/**
|
|
29
|
+
* @inheritDoc
|
|
30
|
+
*/
|
|
31
|
+
init(): void;
|
|
32
|
+
}
|
|
@@ -1,67 +1,67 @@
|
|
|
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 easy-image/cloudservicesuploadadapter
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import { FileRepository } from 'ckeditor5/src/upload';
|
|
10
|
-
/**
|
|
11
|
-
* A plugin that enables upload to [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/).
|
|
12
|
-
*
|
|
13
|
-
* It is mainly used by the {@link module:easy-image/easyimage~EasyImage} feature.
|
|
14
|
-
*
|
|
15
|
-
* After enabling this adapter you need to configure the CKEditor Cloud Services integration through
|
|
16
|
-
* {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudServices`}.
|
|
17
|
-
*/
|
|
18
|
-
export default class CloudServicesUploadAdapter extends Plugin {
|
|
19
|
-
/**
|
|
20
|
-
* @inheritDoc
|
|
21
|
-
*/
|
|
22
|
-
static get pluginName() {
|
|
23
|
-
return 'CloudServicesUploadAdapter';
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* @inheritDoc
|
|
27
|
-
*/
|
|
28
|
-
static get requires() {
|
|
29
|
-
return ['CloudServices', FileRepository];
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* @inheritDoc
|
|
33
|
-
*/
|
|
34
|
-
init() {
|
|
35
|
-
const editor = this.editor;
|
|
36
|
-
const cloudServices = editor.plugins.get('CloudServices');
|
|
37
|
-
const token = cloudServices.token;
|
|
38
|
-
const uploadUrl = cloudServices.uploadUrl;
|
|
39
|
-
if (!token) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const cloudServicesCore = editor.plugins.get('CloudServicesCore');
|
|
43
|
-
this._uploadGateway = cloudServicesCore.createUploadGateway(token, uploadUrl);
|
|
44
|
-
editor.plugins.get(FileRepository).createUploadAdapter = loader => {
|
|
45
|
-
return new Adapter(this._uploadGateway, loader);
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
class Adapter {
|
|
50
|
-
constructor(uploadGateway, loader) {
|
|
51
|
-
this.uploadGateway = uploadGateway;
|
|
52
|
-
this.loader = loader;
|
|
53
|
-
}
|
|
54
|
-
upload() {
|
|
55
|
-
return this.loader.file.then(file => {
|
|
56
|
-
this.fileUploader = this.uploadGateway.upload(file);
|
|
57
|
-
this.fileUploader.on('progress', (evt, data) => {
|
|
58
|
-
this.loader.uploadTotal = data.total;
|
|
59
|
-
this.loader.uploaded = data.uploaded;
|
|
60
|
-
});
|
|
61
|
-
return this.fileUploader.send();
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
abort() {
|
|
65
|
-
this.fileUploader.abort();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
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 easy-image/cloudservicesuploadadapter
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
+
import { FileRepository } from 'ckeditor5/src/upload';
|
|
10
|
+
/**
|
|
11
|
+
* A plugin that enables upload to [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/).
|
|
12
|
+
*
|
|
13
|
+
* It is mainly used by the {@link module:easy-image/easyimage~EasyImage} feature.
|
|
14
|
+
*
|
|
15
|
+
* After enabling this adapter you need to configure the CKEditor Cloud Services integration through
|
|
16
|
+
* {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudServices`}.
|
|
17
|
+
*/
|
|
18
|
+
export default class CloudServicesUploadAdapter extends Plugin {
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
static get pluginName() {
|
|
23
|
+
return 'CloudServicesUploadAdapter';
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
static get requires() {
|
|
29
|
+
return ['CloudServices', FileRepository];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @inheritDoc
|
|
33
|
+
*/
|
|
34
|
+
init() {
|
|
35
|
+
const editor = this.editor;
|
|
36
|
+
const cloudServices = editor.plugins.get('CloudServices');
|
|
37
|
+
const token = cloudServices.token;
|
|
38
|
+
const uploadUrl = cloudServices.uploadUrl;
|
|
39
|
+
if (!token) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const cloudServicesCore = editor.plugins.get('CloudServicesCore');
|
|
43
|
+
this._uploadGateway = cloudServicesCore.createUploadGateway(token, uploadUrl);
|
|
44
|
+
editor.plugins.get(FileRepository).createUploadAdapter = loader => {
|
|
45
|
+
return new Adapter(this._uploadGateway, loader);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
class Adapter {
|
|
50
|
+
constructor(uploadGateway, loader) {
|
|
51
|
+
this.uploadGateway = uploadGateway;
|
|
52
|
+
this.loader = loader;
|
|
53
|
+
}
|
|
54
|
+
upload() {
|
|
55
|
+
return this.loader.file.then(file => {
|
|
56
|
+
this.fileUploader = this.uploadGateway.upload(file);
|
|
57
|
+
this.fileUploader.on('progress', (evt, data) => {
|
|
58
|
+
this.loader.uploadTotal = data.total;
|
|
59
|
+
this.loader.uploaded = data.uploaded;
|
|
60
|
+
});
|
|
61
|
+
return this.fileUploader.send();
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
abort() {
|
|
65
|
+
this.fileUploader.abort();
|
|
66
|
+
}
|
|
67
|
+
}
|
package/src/easyimage.d.ts
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
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 easy-image/easyimage
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import CloudServicesUploadAdapter from './cloudservicesuploadadapter';
|
|
10
|
-
/**
|
|
11
|
-
* The Easy Image feature, which makes the image upload in CKEditor 5 possible with virtually zero
|
|
12
|
-
* server setup. A part of the [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)
|
|
13
|
-
* family.
|
|
14
|
-
*
|
|
15
|
-
* This is a "glue" plugin which enables:
|
|
16
|
-
*
|
|
17
|
-
* * {@link module:easy-image/cloudservicesuploadadapter~CloudServicesUploadAdapter}.
|
|
18
|
-
*
|
|
19
|
-
* This plugin requires plugin to be present in the editor configuration:
|
|
20
|
-
*
|
|
21
|
-
* * {@link module:image/image~Image},
|
|
22
|
-
* * {@link module:image/imageupload~ImageUpload},
|
|
23
|
-
*
|
|
24
|
-
* See the {@glink features/images/image-upload/easy-image "Easy Image integration" guide} to learn how to configure
|
|
25
|
-
* and use this feature.
|
|
26
|
-
*
|
|
27
|
-
* Check out the {@glink features/images/image-upload/image-upload comprehensive "Image upload" guide} to learn about
|
|
28
|
-
* other ways to upload images into CKEditor 5.
|
|
29
|
-
*
|
|
30
|
-
* **Note**: After enabling the Easy Image plugin you need to configure the
|
|
31
|
-
* [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)
|
|
32
|
-
* integration through {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudServices`}.
|
|
33
|
-
*/
|
|
34
|
-
export default class EasyImage extends Plugin {
|
|
35
|
-
/**
|
|
36
|
-
* @inheritDoc
|
|
37
|
-
*/
|
|
38
|
-
static get pluginName(): "EasyImage";
|
|
39
|
-
/**
|
|
40
|
-
* @inheritDoc
|
|
41
|
-
*/
|
|
42
|
-
static get requires(): readonly [typeof CloudServicesUploadAdapter, "ImageUpload"];
|
|
43
|
-
/**
|
|
44
|
-
* @inheritDoc
|
|
45
|
-
*/
|
|
46
|
-
init(): void;
|
|
47
|
-
}
|
|
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 easy-image/easyimage
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
+
import CloudServicesUploadAdapter from './cloudservicesuploadadapter';
|
|
10
|
+
/**
|
|
11
|
+
* The Easy Image feature, which makes the image upload in CKEditor 5 possible with virtually zero
|
|
12
|
+
* server setup. A part of the [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)
|
|
13
|
+
* family.
|
|
14
|
+
*
|
|
15
|
+
* This is a "glue" plugin which enables:
|
|
16
|
+
*
|
|
17
|
+
* * {@link module:easy-image/cloudservicesuploadadapter~CloudServicesUploadAdapter}.
|
|
18
|
+
*
|
|
19
|
+
* This plugin requires plugin to be present in the editor configuration:
|
|
20
|
+
*
|
|
21
|
+
* * {@link module:image/image~Image},
|
|
22
|
+
* * {@link module:image/imageupload~ImageUpload},
|
|
23
|
+
*
|
|
24
|
+
* See the {@glink features/images/image-upload/easy-image "Easy Image integration" guide} to learn how to configure
|
|
25
|
+
* and use this feature.
|
|
26
|
+
*
|
|
27
|
+
* Check out the {@glink features/images/image-upload/image-upload comprehensive "Image upload" guide} to learn about
|
|
28
|
+
* other ways to upload images into CKEditor 5.
|
|
29
|
+
*
|
|
30
|
+
* **Note**: After enabling the Easy Image plugin you need to configure the
|
|
31
|
+
* [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)
|
|
32
|
+
* integration through {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudServices`}.
|
|
33
|
+
*/
|
|
34
|
+
export default class EasyImage extends Plugin {
|
|
35
|
+
/**
|
|
36
|
+
* @inheritDoc
|
|
37
|
+
*/
|
|
38
|
+
static get pluginName(): "EasyImage";
|
|
39
|
+
/**
|
|
40
|
+
* @inheritDoc
|
|
41
|
+
*/
|
|
42
|
+
static get requires(): readonly [typeof CloudServicesUploadAdapter, "ImageUpload"];
|
|
43
|
+
/**
|
|
44
|
+
* @inheritDoc
|
|
45
|
+
*/
|
|
46
|
+
init(): void;
|
|
47
|
+
}
|
package/src/easyimage.js
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
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 easy-image/easyimage
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import { logWarning } from 'ckeditor5/src/utils';
|
|
10
|
-
import CloudServicesUploadAdapter from './cloudservicesuploadadapter';
|
|
11
|
-
/**
|
|
12
|
-
* The Easy Image feature, which makes the image upload in CKEditor 5 possible with virtually zero
|
|
13
|
-
* server setup. A part of the [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)
|
|
14
|
-
* family.
|
|
15
|
-
*
|
|
16
|
-
* This is a "glue" plugin which enables:
|
|
17
|
-
*
|
|
18
|
-
* * {@link module:easy-image/cloudservicesuploadadapter~CloudServicesUploadAdapter}.
|
|
19
|
-
*
|
|
20
|
-
* This plugin requires plugin to be present in the editor configuration:
|
|
21
|
-
*
|
|
22
|
-
* * {@link module:image/image~Image},
|
|
23
|
-
* * {@link module:image/imageupload~ImageUpload},
|
|
24
|
-
*
|
|
25
|
-
* See the {@glink features/images/image-upload/easy-image "Easy Image integration" guide} to learn how to configure
|
|
26
|
-
* and use this feature.
|
|
27
|
-
*
|
|
28
|
-
* Check out the {@glink features/images/image-upload/image-upload comprehensive "Image upload" guide} to learn about
|
|
29
|
-
* other ways to upload images into CKEditor 5.
|
|
30
|
-
*
|
|
31
|
-
* **Note**: After enabling the Easy Image plugin you need to configure the
|
|
32
|
-
* [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)
|
|
33
|
-
* integration through {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudServices`}.
|
|
34
|
-
*/
|
|
35
|
-
export default class EasyImage extends Plugin {
|
|
36
|
-
/**
|
|
37
|
-
* @inheritDoc
|
|
38
|
-
*/
|
|
39
|
-
static get pluginName() {
|
|
40
|
-
return 'EasyImage';
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* @inheritDoc
|
|
44
|
-
*/
|
|
45
|
-
static get requires() {
|
|
46
|
-
return [CloudServicesUploadAdapter, 'ImageUpload'];
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* @inheritDoc
|
|
50
|
-
*/
|
|
51
|
-
init() {
|
|
52
|
-
const editor = this.editor;
|
|
53
|
-
if (!editor.plugins.has('ImageBlockEditing') && !editor.plugins.has('ImageInlineEditing')) {
|
|
54
|
-
/**
|
|
55
|
-
* The Easy Image feature requires one of the following plugins to be loaded to work correctly:
|
|
56
|
-
*
|
|
57
|
-
* * {@link module:image/imageblock~ImageBlock},
|
|
58
|
-
* * {@link module:image/imageinline~ImageInline},
|
|
59
|
-
* * {@link module:image/image~Image} (loads both `ImageBlock` and `ImageInline`)
|
|
60
|
-
*
|
|
61
|
-
* Please make sure your editor configuration is correct.
|
|
62
|
-
*
|
|
63
|
-
* @error easy-image-image-feature-missing
|
|
64
|
-
* @param {module:core/editor/editor~Editor} editor
|
|
65
|
-
*/
|
|
66
|
-
logWarning('easy-image-image-feature-missing', editor);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
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 easy-image/easyimage
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
+
import { logWarning } from 'ckeditor5/src/utils';
|
|
10
|
+
import CloudServicesUploadAdapter from './cloudservicesuploadadapter';
|
|
11
|
+
/**
|
|
12
|
+
* The Easy Image feature, which makes the image upload in CKEditor 5 possible with virtually zero
|
|
13
|
+
* server setup. A part of the [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)
|
|
14
|
+
* family.
|
|
15
|
+
*
|
|
16
|
+
* This is a "glue" plugin which enables:
|
|
17
|
+
*
|
|
18
|
+
* * {@link module:easy-image/cloudservicesuploadadapter~CloudServicesUploadAdapter}.
|
|
19
|
+
*
|
|
20
|
+
* This plugin requires plugin to be present in the editor configuration:
|
|
21
|
+
*
|
|
22
|
+
* * {@link module:image/image~Image},
|
|
23
|
+
* * {@link module:image/imageupload~ImageUpload},
|
|
24
|
+
*
|
|
25
|
+
* See the {@glink features/images/image-upload/easy-image "Easy Image integration" guide} to learn how to configure
|
|
26
|
+
* and use this feature.
|
|
27
|
+
*
|
|
28
|
+
* Check out the {@glink features/images/image-upload/image-upload comprehensive "Image upload" guide} to learn about
|
|
29
|
+
* other ways to upload images into CKEditor 5.
|
|
30
|
+
*
|
|
31
|
+
* **Note**: After enabling the Easy Image plugin you need to configure the
|
|
32
|
+
* [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/)
|
|
33
|
+
* integration through {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudServices`}.
|
|
34
|
+
*/
|
|
35
|
+
export default class EasyImage extends Plugin {
|
|
36
|
+
/**
|
|
37
|
+
* @inheritDoc
|
|
38
|
+
*/
|
|
39
|
+
static get pluginName() {
|
|
40
|
+
return 'EasyImage';
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @inheritDoc
|
|
44
|
+
*/
|
|
45
|
+
static get requires() {
|
|
46
|
+
return [CloudServicesUploadAdapter, 'ImageUpload'];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @inheritDoc
|
|
50
|
+
*/
|
|
51
|
+
init() {
|
|
52
|
+
const editor = this.editor;
|
|
53
|
+
if (!editor.plugins.has('ImageBlockEditing') && !editor.plugins.has('ImageInlineEditing')) {
|
|
54
|
+
/**
|
|
55
|
+
* The Easy Image feature requires one of the following plugins to be loaded to work correctly:
|
|
56
|
+
*
|
|
57
|
+
* * {@link module:image/imageblock~ImageBlock},
|
|
58
|
+
* * {@link module:image/imageinline~ImageInline},
|
|
59
|
+
* * {@link module:image/image~Image} (loads both `ImageBlock` and `ImageInline`)
|
|
60
|
+
*
|
|
61
|
+
* Please make sure your editor configuration is correct.
|
|
62
|
+
*
|
|
63
|
+
* @error easy-image-image-feature-missing
|
|
64
|
+
* @param {module:core/editor/editor~Editor} editor
|
|
65
|
+
*/
|
|
66
|
+
logWarning('easy-image-image-feature-missing', editor);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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 easy-image
|
|
7
|
-
*/
|
|
8
|
-
export { default as EasyImage } from './easyimage';
|
|
9
|
-
export { default as CloudServicesUploadAdapter } from './cloudservicesuploadadapter';
|
|
10
|
-
import './augmentation';
|
|
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 easy-image
|
|
7
|
+
*/
|
|
8
|
+
export { default as EasyImage } from './easyimage';
|
|
9
|
+
export { default as CloudServicesUploadAdapter } from './cloudservicesuploadadapter';
|
|
10
|
+
import './augmentation';
|
package/src/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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 easy-image
|
|
7
|
-
*/
|
|
8
|
-
export { default as EasyImage } from './easyimage';
|
|
9
|
-
export { default as CloudServicesUploadAdapter } from './cloudservicesuploadadapter';
|
|
10
|
-
import './augmentation';
|
|
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 easy-image
|
|
7
|
+
*/
|
|
8
|
+
export { default as EasyImage } from './easyimage';
|
|
9
|
+
export { default as CloudServicesUploadAdapter } from './cloudservicesuploadadapter';
|
|
10
|
+
import './augmentation';
|