Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/queuepro/node_modules/@ckeditor/ckeditor5-easy-image/src/ drwxrwxr-x | |
| Viewing file: Select action/file-type: /**
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
/**
* @module easy-image/cloudservicesuploadadapter
*/
import { Plugin } from 'ckeditor5/src/core';
import { FileRepository } from 'ckeditor5/src/upload';
/**
* A plugin that enables upload to [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services/).
*
* It is mainly used by the {@link module:easy-image/easyimage~EasyImage} feature.
*
* After enabling this adapter you need to configure the CKEditor Cloud Services integration through
* {@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 );
};
}
}
/**
* @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();
}
}
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0052 ]-- |