Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ckeditor/ckeditor5-easy-image

Package Overview
Dependencies
Maintainers
1
Versions
785
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-easy-image - npm Package Compare versions

Comparing version 36.0.1 to 37.0.0-alpha.0

src/cloudservicesuploadadapter.d.ts

2

build/easy-image.js
/*!
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md.
*/(()=>{var e={704:(e,t,r)=>{e.exports=r(79)("./src/core.js")},448:(e,t,r)=>{e.exports=r(79)("./src/upload.js")},209:(e,t,r)=>{e.exports=r(79)("./src/utils.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function r(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{"use strict";r.r(o),r.d(o,{CloudServicesUploadAdapter:()=>i,EasyImage:()=>l});var e=r(704),t=r(209),a=r(448);class i extends e.Plugin{static get pluginName(){return"CloudServicesUploadAdapter"}static get requires(){return["CloudServices",a.FileRepository]}init(){const e=this.editor,t=e.plugins.get("CloudServices"),r=t.token,o=t.uploadUrl;r&&(this._uploadGateway=e.plugins.get("CloudServicesCore").createUploadGateway(r,o),e.plugins.get(a.FileRepository).createUploadAdapter=e=>new s(this._uploadGateway,e))}}class s{constructor(e,t){this.uploadGateway=e,this.loader=t}upload(){return this.loader.file.then((e=>(this.fileUploader=this.uploadGateway.upload(e),this.fileUploader.on("progress",((e,t)=>{this.loader.uploadTotal=t.total,this.loader.uploaded=t.uploaded})),this.fileUploader.send())))}abort(){this.fileUploader.abort()}}class l extends e.Plugin{static get requires(){return[i,"ImageUpload"]}init(){const e=this.editor;e.plugins.has("ImageBlockEditing")||e.plugins.has("ImageInlineEditing")||(0,t.logWarning)("easy-image-image-feature-missing",e)}static get pluginName(){return"EasyImage"}}})(),(window.CKEditor5=window.CKEditor5||{}).easyImage=o})();
*/(()=>{var e={704:(e,t,r)=>{e.exports=r(79)("./src/core.js")},448:(e,t,r)=>{e.exports=r(79)("./src/upload.js")},209:(e,t,r)=>{e.exports=r(79)("./src/utils.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function r(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{"use strict";r.r(o),r.d(o,{CloudServicesUploadAdapter:()=>i,EasyImage:()=>l});var e=r(704),t=r(209),a=r(448);class i extends e.Plugin{static get pluginName(){return"CloudServicesUploadAdapter"}static get requires(){return["CloudServices",a.FileRepository]}init(){const e=this.editor,t=e.plugins.get("CloudServices"),r=t.token,o=t.uploadUrl;if(!r)return;const i=e.plugins.get("CloudServicesCore");this._uploadGateway=i.createUploadGateway(r,o),e.plugins.get(a.FileRepository).createUploadAdapter=e=>new s(this._uploadGateway,e)}}class s{constructor(e,t){this.uploadGateway=e,this.loader=t}upload(){return this.loader.file.then((e=>(this.fileUploader=this.uploadGateway.upload(e),this.fileUploader.on("progress",((e,t)=>{this.loader.uploadTotal=t.total,this.loader.uploaded=t.uploaded})),this.fileUploader.send())))}abort(){this.fileUploader?.abort()}}class l extends e.Plugin{static get pluginName(){return"EasyImage"}static get requires(){return[i,"ImageUpload"]}init(){const e=this.editor;e.plugins.has("ImageBlockEditing")||e.plugins.has("ImageInlineEditing")||(0,t.logWarning)("easy-image-image-feature-missing",e)}}})(),(window.CKEditor5=window.CKEditor5||{}).easyImage=o})();
{
"name": "@ckeditor/ckeditor5-easy-image",
"version": "36.0.1",
"version": "37.0.0-alpha.0",
"description": "Easy Image feature for CKEditor 5.",

@@ -15,15 +15,16 @@ "keywords": [

"dependencies": {
"ckeditor5": "^36.0.1"
"ckeditor5": "^37.0.0-alpha.0"
},
"devDependencies": {
"@ckeditor/ckeditor5-clipboard": "^36.0.1",
"@ckeditor/ckeditor5-cloud-services": "^36.0.1",
"@ckeditor/ckeditor5-core": "^36.0.1",
"@ckeditor/ckeditor5-dev-utils": "^32.0.0",
"@ckeditor/ckeditor5-editor-classic": "^36.0.1",
"@ckeditor/ckeditor5-image": "^36.0.1",
"@ckeditor/ckeditor5-paragraph": "^36.0.1",
"@ckeditor/ckeditor5-theme-lark": "^36.0.1",
"@ckeditor/ckeditor5-upload": "^36.0.1",
"@ckeditor/ckeditor5-utils": "^36.0.1",
"@ckeditor/ckeditor5-clipboard": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-cloud-services": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-core": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-dev-utils": "^34.0.0",
"@ckeditor/ckeditor5-editor-classic": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-image": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-paragraph": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-theme-lark": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-upload": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-utils": "^37.0.0-alpha.0",
"typescript": "^4.8.4",
"webpack": "^5.58.1",

@@ -47,3 +48,4 @@ "webpack-cli": "^4.9.0"

"lang",
"src",
"src/**/*.js",
"src/**/*.d.ts",
"theme",

@@ -55,4 +57,7 @@ "build",

"scripts": {
"build": "tsc -p ./tsconfig.release.json",
"postversion": "npm run build",
"dll:build": "webpack"
}
},
"types": "src/index.d.ts"
}

@@ -5,10 +5,7 @@ /**

*/
/**
* @module easy-image/cloudservicesuploadadapter
*/
import { Plugin } from 'ckeditor5/src/core';
import { FileRepository } from 'ckeditor5/src/upload';
/**

@@ -21,70 +18,52 @@ * A plugin that enables upload to [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/).

* {@link module:cloud-services/cloudservices~CloudServicesConfig `config.cloudServices`}.
*
* @extends module:core/plugin~Plugin
*/
export default class CloudServicesUploadAdapter extends Plugin {
/**
* @inheritDoc
*/
static get pluginName() {
return 'CloudServicesUploadAdapter';
}
/**
* @inheritDoc
*/
static get requires() {
return [ 'CloudServices', FileRepository ];
}
/**
* @inheritDoc
*/
init() {
const editor = this.editor;
const cloudServices = editor.plugins.get( 'CloudServices' );
const token = cloudServices.token;
const uploadUrl = cloudServices.uploadUrl;
if ( !token ) {
return;
}
this._uploadGateway = editor.plugins.get( 'CloudServicesCore' ).createUploadGateway( token, uploadUrl );
editor.plugins.get( FileRepository ).createUploadAdapter = loader => {
return new Adapter( this._uploadGateway, loader );
};
}
/**
* @inheritDoc
*/
static get pluginName() {
return 'CloudServicesUploadAdapter';
}
/**
* @inheritDoc
*/
static get requires() {
return ['CloudServices', FileRepository];
}
/**
* @inheritDoc
*/
init() {
const editor = this.editor;
const cloudServices = editor.plugins.get('CloudServices');
const token = cloudServices.token;
const uploadUrl = cloudServices.uploadUrl;
if (!token) {
return;
}
const cloudServicesCore = editor.plugins.get('CloudServicesCore');
this._uploadGateway = cloudServicesCore.createUploadGateway(token, uploadUrl);
editor.plugins.get(FileRepository).createUploadAdapter = loader => {
return new Adapter(this._uploadGateway, loader);
};
}
}
/**
* @private
*/
class Adapter {
constructor( uploadGateway, loader ) {
this.uploadGateway = uploadGateway;
this.loader = loader;
}
upload() {
return this.loader.file.then( file => {
this.fileUploader = this.uploadGateway.upload( file );
this.fileUploader.on( 'progress', ( evt, data ) => {
this.loader.uploadTotal = data.total;
this.loader.uploaded = data.uploaded;
} );
return this.fileUploader.send();
} );
}
abort() {
this.fileUploader.abort();
}
constructor(uploadGateway, loader) {
this.uploadGateway = uploadGateway;
this.loader = loader;
}
upload() {
return this.loader.file.then(file => {
this.fileUploader = this.uploadGateway.upload(file);
this.fileUploader.on('progress', (evt, data) => {
this.loader.uploadTotal = data.total;
this.loader.uploaded = data.uploaded;
});
return this.fileUploader.send();
});
}
abort() {
this.fileUploader?.abort();
}
}

@@ -5,12 +5,8 @@ /**

*/
/**
* @module easy-image/easyimage
*/
import { Plugin } from 'ckeditor5/src/core';
import { logWarning } from 'ckeditor5/src/utils';
import CloudServicesUploadAdapter from './cloudservicesuploadadapter';
/**

@@ -39,42 +35,37 @@ * The Easy Image feature, which makes the image upload in CKEditor 5 possible with virtually zero

* integration through {@link module:cloud-services/cloudservices~CloudServicesConfig `config.cloudServices`}.
*
* @extends module:core/plugin~Plugin
*/
export default class EasyImage extends Plugin {
/**
* @inheritDoc
*/
static get requires() {
return [ CloudServicesUploadAdapter, 'ImageUpload' ];
}
/**
* @inheritDoc
*/
init() {
const editor = this.editor;
if ( !editor.plugins.has( 'ImageBlockEditing' ) && !editor.plugins.has( 'ImageInlineEditing' ) ) {
/**
* The Easy Image feature requires one of the following plugins to be loaded to work correctly:
*
* * {@link module:image/imageblock~ImageBlock},
* * {@link module:image/imageinline~ImageInline},
* * {@link module:image/image~Image} (loads both `ImageBlock` and `ImageInline`)
*
* Please make sure your editor configuration is correct.
*
* @error easy-image-image-feature-missing
* @param {module:core/editor/editor~Editor} editor
*/
logWarning( 'easy-image-image-feature-missing', editor );
}
}
/**
* @inheritDoc
*/
static get pluginName() {
return 'EasyImage';
}
/**
* @inheritDoc
*/
static get pluginName() {
return 'EasyImage';
}
/**
* @inheritDoc
*/
static get requires() {
return [CloudServicesUploadAdapter, 'ImageUpload'];
}
/**
* @inheritDoc
*/
init() {
const editor = this.editor;
if (!editor.plugins.has('ImageBlockEditing') && !editor.plugins.has('ImageInlineEditing')) {
/**
* The Easy Image feature requires one of the following plugins to be loaded to work correctly:
*
* * {@link module:image/imageblock~ImageBlock},
* * {@link module:image/imageinline~ImageInline},
* * {@link module:image/image~Image} (loads both `ImageBlock` and `ImageInline`)
*
* Please make sure your editor configuration is correct.
*
* @error easy-image-image-feature-missing
* @param {module:core/editor/editor~Editor} editor
*/
logWarning('easy-image-image-feature-missing', editor);
}
}
}

@@ -5,8 +5,6 @@ /**

*/
/**
* @module easy-image
*/
export { default as EasyImage } from './easyimage';
export { default as CloudServicesUploadAdapter } from './cloudservicesuploadadapter';
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc