@ckeditor/ckeditor5-cloud-services 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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-services.js","mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEmD;AACC;AACA;;AAEpD;AACA;AACA;AACA;AACA,QAAQ,oFAAoF;AAC5F;AACA;AACA;AACe,4BAA4B,6DAAa;AACxD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,0DAAiB;AAC5B;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;;AAEA;AACA;AACA,MAAM,wEAAwE;AAC9E;AACA;AACA,cAAc,2BAA2B;AACzC;;AAEA;AACA;AACA;AACA;AACA,cAAc,QAAQ;AACtB;;AAEA;AACA;AACA,+BAA+B,wEAAwE;AACvG;AACA;AACA,cAAc,wCAAwC;AACtD;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK,wEAAwE;AAC7E;AACA,YAAY,iBAAiB;AAC7B,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA,uEAAuE,wBAAwB;AAC/F;AACA,YAAY,iBAAiB;AAC7B,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,qDAAqD,yEAAyE;AAC9H;AACA;AACA;AACA,aAAa,8DAAa;AAC1B;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,oEAAoE,yDAAyD;AAC7H;AACA,iBAAiB,8DAA8D;AAC/E;AACA,YAAY,yDAAyD;AACrE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,QAAQ,sEAAsE;AAC9E;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,yDAAyD,qDAAqD;AAC9G,IAAI,2DAA2D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA,IAAI;AACJ,QAAQ,2EAA2E;AACnF;AACA;AACA;AACA,YAAY,iBAAiB;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,mEAAmE;AACzH;AACA,oCAAoC,wEAAwE;AAC5G;AACA,YAAY,QAAQ;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;;;;;;;;;;;;;;;;;;;ACtQA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEmD;AACjB;AACwB;;AAE1D;AACA;AACA;AACA;AACA;AACe,gCAAgC,6DAAa;AAC5D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iBAAiB,yCAAyC;AAC1D;AACA,YAAY,iBAAiB;AAC7B,6CAA6C,gDAAgD;AAC7F,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB,YAAY,SAAS;AACrB,cAAc;AACd;AACA;AACA,aAAa,oDAAK;AAClB;;AAEA;AACA,iBAAiB,uEAAuE;AACxF;AACA,YAAY,mCAAmC;AAC/C,YAAY,QAAQ;AACpB,cAAc;AACd;AACA;AACA,aAAa,oEAAa;AAC1B;AACA;;;;;;;;;;;;;;;;;AClDA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAE0E;;AAE1E,0BAA0B;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,iBAAiB;AAC7B,6CAA6C,gDAAgD;AAC7F,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,8DAAa;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,QAAQ;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA,YAAY;AACZ;AACA;AACA,mCAAmC;AACnC;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,IAAI;AACJ;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,8DAAa;AAC1B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,WAAW,uBAAuB;;AAElC;AACA;AACA;;AAEA;;AAEA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA,2BAA2B,yCAAyC;AACpE;AACA,YAAY,iBAAiB;AAC7B,6CAA6C,gDAAgD;AAC7F,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB,YAAY,SAAS;AACrB,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;;AAEA,wDAAG,SAAS,gEAAe;;AAE3B;AACA,yDAAyD,cAAc;AACvE;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,8DAAa;AACtB;AACA;;AAEA;AACA,IAAI;;AAEJ;AACA;;AAEA;AACA,GAAG;AACH;;AAEA,iEAAe,KAAK,EAAC;;;;;;;;;;;;;;;;;AClQrB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEuE;;AAEvE,4CAA4C;;AAE5C;AACA;AACA;AACe;AACf;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,mCAAmC;AAC/C,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,8DAAa;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,8DAAa;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,8DAAa;AAC1B;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,UAAU;AACtB,cAAc;AACd;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,UAAU;AACtB,cAAc;AACd;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,8DAAa;AACtC;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;;AAEA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;;AAEA,wDAAG,gBAAgB,6DAAY;;AAE/B;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,wBAAwB,4BAA4B;AACpD;AACA;;AAEA,oBAAoB,kBAAkB;AACtC;AACA;;AAEA;AACA;;AAEA,iCAAiC,oBAAoB;AACrD,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,YAAY,8DAAa;AACzB;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;;AChSA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE0C;AACU;;AAEpD;AACA;AACA;AACe;AACf;AACA;AACA;AACA,YAAY,mCAAmC;AAC/C,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,8DAAa;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,8DAAa;AAC1B;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA,eAAe,qEAAqE;AACpF;AACA,KAAK,0EAA0E;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,cAAc,+DAA+D;AAC7E;AACA;AACA,aAAa,qDAAY;AACzB;AACA;;;;;;;;;;;;AC5EA;;;;;;;;;;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;;AAE2D;AACQ","sources":["webpack://CKEditor5.cloudServices/./src/cloudservices.js","webpack://CKEditor5.cloudServices/./src/cloudservicescore.js","webpack://CKEditor5.cloudServices/./src/token/token.js","webpack://CKEditor5.cloudServices/./src/uploadgateway/fileuploader.js","webpack://CKEditor5.cloudServices/./src/uploadgateway/uploadgateway.js","webpack://CKEditor5.cloudServices/delegated \"./src/core.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.cloudServices/delegated \"./src/utils.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.cloudServices/external var \"CKEditor5.dll\"","webpack://CKEditor5.cloudServices/webpack/bootstrap","webpack://CKEditor5.cloudServices/webpack/runtime/define property getters","webpack://CKEditor5.cloudServices/webpack/runtime/hasOwnProperty shorthand","webpack://CKEditor5.cloudServices/webpack/runtime/make namespace object","webpack://CKEditor5.cloudServices/./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 cloud-services/cloudservices\n */\n\nimport { ContextPlugin } from 'ckeditor5/src/core';\nimport { CKEditorError } from 'ckeditor5/src/utils';\nimport CloudServicesCore from './cloudservicescore';\n\n/**\n * Plugin introducing the integration between CKEditor 5 and CKEditor Cloud Services .\n *\n * It initializes the token provider based on\n * the {@link module:cloud-services/cloudservices~CloudServicesConfig `config.cloudService`}.\n *\n * @extends module:core/contextplugin~ContextPlugin\n */\nexport default class CloudServices extends ContextPlugin {\n\t/**\n\t * @inheritdoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'CloudServices';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ CloudServicesCore ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\n\t\tconst config = this.context.config;\n\n\t\tconst options = config.get( 'cloudServices' ) || {};\n\n\t\tfor ( const optionName in options ) {\n\t\t\tthis[ optionName ] = options[ optionName ];\n\t\t}\n\n\t\t/**\n\t\t * A map of token object instances keyed by the token URLs.\n\t\t *\n\t\t * @private\n\t\t * @type {Map.<String, module:cloud-services/token~Token>}\n\t\t */\n\t\tthis._tokens = new Map();\n\n\t\t/**\n\t\t * The authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the\n\t\t * {@link module:cloud-services/cloudservices~CloudServicesConfig#tokenUrl} for more details.\n\t\t *\n\t\t * @readonly\n\t\t * @member {String|Function|undefined} #tokenUrl\n\t\t */\n\n\t\t/**\n\t\t * The URL to which the files should be uploaded.\n\t\t *\n\t\t * @readonly\n\t\t * @member {String} #uploadUrl\n\t\t */\n\n\t\t/**\n\t\t * Other plugins use this token for the authorization process. It handles token requesting and refreshing.\n\t\t * Its value is `null` when {@link module:cloud-services/cloudservices~CloudServicesConfig#tokenUrl} is not provided.\n\t\t *\n\t\t * @readonly\n\t\t * @member {module:cloud-services/token~Token|null} #token\n\t\t */\n\n\t\tif ( !this.tokenUrl ) {\n\t\t\tthis.token = null;\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis.token = this.context.plugins.get( 'CloudServicesCore' ).createToken( this.tokenUrl );\n\n\t\tthis._tokens.set( this.tokenUrl, this.token );\n\n\t\treturn this.token.init();\n\t}\n\n\t/**\n\t * Registers an additional authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the\n\t * {@link module:cloud-services/cloudservices~CloudServicesConfig#tokenUrl} for more details.\n\t *\n\t * @param {String|Function} tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.\n\t * @returns {Promise.<module:cloud-services/token~Token>}\n\t */\n\tregisterTokenUrl( tokenUrl ) {\n\t\t// Reuse the token instance in case of multiple features using the same token URL.\n\t\tif ( this._tokens.has( tokenUrl ) ) {\n\t\t\treturn Promise.resolve( this.getTokenFor( tokenUrl ) );\n\t\t}\n\n\t\tconst token = this.context.plugins.get( 'CloudServicesCore' ).createToken( tokenUrl );\n\n\t\tthis._tokens.set( tokenUrl, token );\n\n\t\treturn token.init();\n\t}\n\n\t/**\n\t * Returns an authentication token provider previously registered by {@link #registerTokenUrl}.\n\t *\n\t * @param {String|Function} tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.\n\t * @returns {module:cloud-services/token~Token}\n\t */\n\tgetTokenFor( tokenUrl ) {\n\t\tconst token = this._tokens.get( tokenUrl );\n\n\t\tif ( !token ) {\n\t\t\t/**\n\t\t\t * The provided `tokenUrl` was not registered by {@link module:cloud-services/cloudservices~CloudServices#registerTokenUrl}.\n\t\t\t *\n\t\t\t * @error cloudservices-token-not-registered\n\t\t\t */\n\t\t\tthrow new CKEditorError( 'cloudservices-token-not-registered', this );\n\t\t}\n\n\t\treturn token;\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tdestroy() {\n\t\tsuper.destroy();\n\n\t\tfor ( const token of this._tokens.values() ) {\n\t\t\ttoken.destroy();\n\t\t}\n\t}\n}\n\n/**\n * The configuration of CKEditor Cloud Services. Introduced by the {@link module:cloud-services/cloudservices~CloudServices} plugin.\n *\n * Read more in {@link module:cloud-services/cloudservices~CloudServicesConfig}.\n *\n * @member {module:cloud-services/cloudservices~CloudServicesConfig} module:core/editor/editorconfig~EditorConfig#cloudServices\n */\n\n/**\n * The configuration for all plugins using CKEditor Cloud Services.\n *\n *\t\tClassicEditor\n *\t\t\t.create( document.querySelector( '#editor' ), {\n *\t\t\t\tcloudServices: {\n *\t\t\t\t\ttokenUrl: 'https://example.com/cs-token-endpoint',\n *\t\t\t\t\tuploadUrl: 'https://your-organization-id.cke-cs.com/easyimage/upload/'\n *\t\t\t\t}\n *\t\t\t} )\n *\t\t\t.then( ... )\n *\t\t\t.catch( ... );\n *\n * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.\n *\n * @interface CloudServicesConfig\n */\n\n/**\n * A token URL or a token request function.\n *\n * As a string, it should be a URL to the security token endpoint in your application. The role of this endpoint is to securely authorize\n * the end users of your application to use [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services) only\n * if they should have access e.g. to upload files with {@glink @cs guides/easy-image/quick-start Easy Image} or to use the\n * {@glink @cs guides/collaboration/quick-start Collaboration} service.\n *\n *\t\tClassicEditor\n *\t\t\t.create( document.querySelector( '#editor' ), {\n *\t\t\t\tcloudServices: {\n *\t\t\t\t\ttokenUrl: 'https://example.com/cs-token-endpoint',\n *\t\t\t\t\t...\n *\t\t\t\t}\n *\t\t\t} )\n *\t\t\t.then( ... )\n *\t\t\t.catch( ... );\n *\n * As a function, it should provide a promise to the token value, so you can highly customize the token and provide your token URL endpoint.\n * By using this approach you can set your own headers for the request.\n *\n * \t\tClassicEditor\n *\t\t\t.create( document.querySelector( '#editor' ), {\n *\t\t\t\tcloudServices: {\n *\t\t\t\t\ttokenUrl: () => new Promise( ( resolve, reject ) => {\n *\t\t\t\t\t\tconst xhr = new XMLHttpRequest();\n *\n *\t\t\t\t\t\txhr.open( 'GET', 'https://example.com/cs-token-endpoint' );\n *\n *\t\t\t\t\t\txhr.addEventListener( 'load', () => {\n *\t\t\t\t\t\t\tconst statusCode = xhr.status;\n *\t\t\t\t\t\t\tconst xhrResponse = xhr.response;\n *\n *\t\t\t\t\t\t\tif ( statusCode < 200 || statusCode > 299 ) {\n *\t\t\t\t\t\t\t\treturn reject( new Error( 'Cannot download new token!' ) );\n *\t\t\t\t\t\t\t}\n *\n *\t\t\t\t\t\t\treturn resolve( xhrResponse );\n *\t\t\t\t\t\t} );\n *\n *\t\t\t\t\t\txhr.addEventListener( 'error', () => reject( new Error( 'Network Error' ) ) );\n *\t\t\t\t\t\txhr.addEventListener( 'abort', () => reject( new Error( 'Abort' ) ) );\n *\n *\t\t\t\t\t\txhr.setRequestHeader( customHeader, customValue );\n *\n *\t\t\t\t\t\txhr.send();\n *\t\t\t\t\t} ),\n *\t\t\t\t\t...\n *\t\t\t\t}\n *\t\t\t} )\n *\n * You can find more information about token endpoints in the\n * {@glink @cs guides/easy-image/quick-start#create-token-endpoint Cloud Services - Quick start}\n * and {@glink @cs guides/security/token-endpoint Cloud Services - Token endpoint} documentation.\n *\n * Without a properly working token endpoint (token URL) CKEditor plugins will not be able to connect to CKEditor Cloud Services.\n *\n * @member {String|Function} module:cloud-services/cloudservices~CloudServicesConfig#tokenUrl\n */\n\n/**\n * The endpoint URL for [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services) uploads.\n * This option must be set for Easy Image to work correctly.\n *\n * The upload URL is unique for each customer and can be found in the\n * [CKEditor Ecosystem customer dashboard](https://dashboard.ckeditor.com) after subscribing to the Easy Image service.\n * To learn how to start using Easy Image, check the {@glink @cs guides/easy-image/quick-start Easy Image - Quick start} documentation.\n *\n * Note: Make sure to also set the {@link module:cloud-services/cloudservices~CloudServicesConfig#tokenUrl} configuration option.\n *\n * @member {String} module:cloud-services/cloudservices~CloudServicesConfig#uploadUrl\n */\n\n/**\n * The URL for web socket communication, used by the `RealTimeCollaborativeEditing` plugin. Every customer (organization in the CKEditor\n * Ecosystem dashboard) has their own, unique URLs to communicate with CKEditor Cloud Services. The URL can be found in the\n * CKEditor Ecosystem customer dashboard.\n *\n * Note: Unlike most plugins, `RealTimeCollaborativeEditing` is not included in any CKEditor 5 build and needs to be installed manually.\n * Check [Collaboration overview](https://ckeditor.com/docs/ckeditor5/latest/features/collaboration/overview.html) for more details.\n *\n * @member {String} module:cloud-services/cloudservices~CloudServicesConfig#webSocketUrl\n */\n\n/**\n * An optional parameter used for integration with CKEditor Cloud Services when uploading the editor build to cloud services.\n *\n * Whenever the editor build or the configuration changes, this parameter should be set to a new, unique value to differentiate\n * the new bundle (build + configuration) from the old ones.\n *\n * @member {String} module:cloud-services/cloudservices~CloudServicesConfig#bundleVersion\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 cloud-services/cloudservicescore\n */\n\nimport { ContextPlugin } from 'ckeditor5/src/core';\nimport Token from './token/token';\nimport UploadGateway from './uploadgateway/uploadgateway';\n\n/**\n * The `CloudServicesCore` plugin exposes the base API for communication with CKEditor Cloud Services.\n *\n * @extends module:core/contextplugin~ContextPlugin\n */\nexport default class CloudServicesCore extends ContextPlugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'CloudServicesCore';\n\t}\n\n\t/**\n\t * Creates the {@link module:cloud-services/token~Token} instance.\n\t *\n\t * @param {String|Function} tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the\n\t * value is a function it has to match the {@link module:cloud-services/token~refreshToken} interface.\n\t * @param {Object} [options]\n\t * @param {String} [options.initValue] Initial value of the token.\n\t * @param {Boolean} [options.autoRefresh=true] Specifies whether to start the refresh automatically.\n\t * @returns {module:cloud-services/token~Token}\n\t */\n\tcreateToken( tokenUrlOrRefreshToken, options ) {\n\t\treturn new Token( tokenUrlOrRefreshToken, options );\n\t}\n\n\t/**\n\t * Creates the {@link module:cloud-services/uploadgateway/uploadgateway~UploadGateway} instance.\n\t *\n\t * @param {module:cloud-services/token~Token} token Token used for authentication.\n\t * @param {String} apiAddress API address.\n\t * @returns {module:cloud-services/uploadgateway/uploadgateway~UploadGateway}\n\t */\n\tcreateUploadGateway( token, apiAddress ) {\n\t\treturn new UploadGateway( token, apiAddress );\n\t}\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 cloud-services/token\n */\n\n/* globals XMLHttpRequest, setTimeout, clearTimeout, atob */\n\nimport { mix, ObservableMixin, CKEditorError } from 'ckeditor5/src/utils';\n\nconst DEFAULT_OPTIONS = { autoRefresh: true };\nconst DEFAULT_TOKEN_REFRESH_TIMEOUT_TIME = 3600000;\n\n/**\n * Class representing the token used for communication with CKEditor Cloud Services.\n * Value of the token is retrieving from the specified URL and is refreshed every 1 hour by default.\n *\n * @mixes ObservableMixin\n */\nclass Token {\n\t/**\n\t * Creates `Token` instance.\n\t * Method `init` should be called after using the constructor or use `create` method instead.\n\t *\n\t * @param {String|Function} tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the\n\t * value is a function it has to match the {@link module:cloud-services/token~refreshToken} interface.\n\t * @param {Object} options\n\t * @param {String} [options.initValue] Initial value of the token.\n\t * @param {Boolean} [options.autoRefresh=true] Specifies whether to start the refresh automatically.\n\t */\n\tconstructor( tokenUrlOrRefreshToken, options = DEFAULT_OPTIONS ) {\n\t\tif ( !tokenUrlOrRefreshToken ) {\n\t\t\t/**\n\t\t\t * A `tokenUrl` must be provided as the first constructor argument.\n\t\t\t *\n\t\t\t * @error token-missing-token-url\n\t\t\t */\n\t\t\tthrow new CKEditorError(\n\t\t\t\t'token-missing-token-url',\n\t\t\t\tthis\n\t\t\t);\n\t\t}\n\n\t\tif ( options.initValue ) {\n\t\t\tthis._validateTokenValue( options.initValue );\n\t\t}\n\n\t\t/**\n\t\t * Value of the token.\n\t\t * The value of the token is null if `initValue` is not provided or `init` method was not called.\n\t\t * `create` method creates token with initialized value from url.\n\t\t *\n\t\t * @name value\n\t\t * @member {String} #value\n\t\t * @observable\n\t\t * @readonly\n\t\t */\n\t\tthis.set( 'value', options.initValue );\n\n\t\t/**\n\t\t * Base refreshing function.\n\t\t *\n\t\t * @private\n\t\t * @member {String|Function} #_refresh\n\t\t */\n\t\tif ( typeof tokenUrlOrRefreshToken === 'function' ) {\n\t\t\tthis._refresh = tokenUrlOrRefreshToken;\n\t\t} else {\n\t\t\tthis._refresh = () => defaultRefreshToken( tokenUrlOrRefreshToken );\n\t\t}\n\n\t\t/**\n\t\t * @type {Object}\n\t\t * @private\n\t\t */\n\t\tthis._options = Object.assign( {}, DEFAULT_OPTIONS, options );\n\t}\n\n\t/**\n\t * Initializes the token.\n\t *\n\t * @returns {Promise.<module:cloud-services/token~Token>}\n\t */\n\tinit() {\n\t\treturn new Promise( ( resolve, reject ) => {\n\t\t\tif ( !this.value ) {\n\t\t\t\tthis.refreshToken()\n\t\t\t\t\t.then( resolve )\n\t\t\t\t\t.catch( reject );\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( this._options.autoRefresh ) {\n\t\t\t\tthis._registerRefreshTokenTimeout();\n\t\t\t}\n\n\t\t\tresolve( this );\n\t\t} );\n\t}\n\n\t/**\n\t * Refresh token method. Useful in a method form as it can be override in tests.\n\t * @returns {Promise.<String>}\n\t */\n\trefreshToken() {\n\t\treturn this._refresh()\n\t\t\t.then( value => {\n\t\t\t\tthis._validateTokenValue( value );\n\t\t\t\tthis.set( 'value', value );\n\n\t\t\t\tif ( this._options.autoRefresh ) {\n\t\t\t\t\tthis._registerRefreshTokenTimeout();\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.then( () => this );\n\t}\n\n\t/**\n\t * Destroys token instance. Stops refreshing.\n\t */\n\tdestroy() {\n\t\tclearTimeout( this._tokenRefreshTimeout );\n\t}\n\n\t/**\n\t * Checks whether the provided token follows the JSON Web Tokens (JWT) format.\n\t *\n\t * @protected\n\t * @param {String} tokenValue The token to validate.\n\t */\n\t_validateTokenValue( tokenValue ) {\n\t\t// The token must be a string.\n\t\tconst isString = typeof tokenValue === 'string';\n\n\t\t// The token must be a plain string without quotes (\"\").\n\t\tconst isPlainString = !/^\".*\"$/.test( tokenValue );\n\n\t\t// JWT token contains 3 parts: header, payload, and signature.\n\t\t// Each part is separated by a dot.\n\t\tconst isJWTFormat = isString && tokenValue.split( '.' ).length === 3;\n\n\t\tif ( !( isPlainString && isJWTFormat ) ) {\n\t\t\t/**\n\t\t\t * The provided token must follow the [JSON Web Tokens](https://jwt.io/introduction/) format.\n\t\t\t *\n\t\t\t * @error token-not-in-jwt-format\n\t\t\t */\n\t\t\tthrow new CKEditorError( 'token-not-in-jwt-format', this );\n\t\t}\n\t}\n\n\t/**\n\t * Registers a refresh token timeout for the time taken from token.\n\t *\n\t * @protected\n\t */\n\t_registerRefreshTokenTimeout() {\n\t\tconst tokenRefreshTimeoutTime = this._getTokenRefreshTimeoutTime();\n\n\t\tclearTimeout( this._tokenRefreshTimeout );\n\n\t\tthis._tokenRefreshTimeout = setTimeout( () => {\n\t\t\tthis.refreshToken();\n\t\t}, tokenRefreshTimeoutTime );\n\t}\n\n\t/**\n\t * Returns token refresh timeout time calculated from expire time in the token payload.\n\t *\n\t * If the token parse fails or the token payload doesn't contain, the default DEFAULT_TOKEN_REFRESH_TIMEOUT_TIME is returned.\n\t *\n\t * @protected\n\t * @returns {Number}\n\t */\n\t_getTokenRefreshTimeoutTime() {\n\t\ttry {\n\t\t\tconst [ , binaryTokenPayload ] = this.value.split( '.' );\n\t\t\tconst { exp: tokenExpireTime } = JSON.parse( atob( binaryTokenPayload ) );\n\n\t\t\tif ( !tokenExpireTime ) {\n\t\t\t\treturn DEFAULT_TOKEN_REFRESH_TIMEOUT_TIME;\n\t\t\t}\n\n\t\t\tconst tokenRefreshTimeoutTime = Math.floor( ( ( tokenExpireTime * 1000 ) - Date.now() ) / 2 );\n\n\t\t\treturn tokenRefreshTimeoutTime;\n\t\t} catch ( err ) {\n\t\t\treturn DEFAULT_TOKEN_REFRESH_TIMEOUT_TIME;\n\t\t}\n\t}\n\n\t/**\n\t * Creates a initialized {@link module:cloud-services/token~Token} instance.\n\t *\n\t * @param {String|Function} tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the\n\t * value is a function it has to match the {@link module:cloud-services/token~refreshToken} interface.\n\t * @param {Object} options\n\t * @param {String} [options.initValue] Initial value of the token.\n\t * @param {Boolean} [options.autoRefresh=true] Specifies whether to start the refresh automatically.\n\t * @returns {Promise.<module:cloud-services/token~Token>}\n\t */\n\tstatic create( tokenUrlOrRefreshToken, options = DEFAULT_OPTIONS ) {\n\t\tconst token = new Token( tokenUrlOrRefreshToken, options );\n\n\t\treturn token.init();\n\t}\n}\n\nmix( Token, ObservableMixin );\n\n/**\n * This function is called in a defined interval by the {@link ~Token} class. It also can be invoked manually.\n * It should return a promise, which resolves with the new token value.\n * If any error occurs it should return a rejected promise with an error message.\n *\n * @function refreshToken\n * @returns {Promise.<String>}\n */\n\n/**\n * @private\n * @param {String} tokenUrl\n */\nfunction defaultRefreshToken( tokenUrl ) {\n\treturn new Promise( ( resolve, reject ) => {\n\t\tconst xhr = new XMLHttpRequest();\n\n\t\txhr.open( 'GET', tokenUrl );\n\n\t\txhr.addEventListener( 'load', () => {\n\t\t\tconst statusCode = xhr.status;\n\t\t\tconst xhrResponse = xhr.response;\n\n\t\t\tif ( statusCode < 200 || statusCode > 299 ) {\n\t\t\t\t/**\n\t\t\t\t * Cannot download new token from the provided url.\n\t\t\t\t *\n\t\t\t\t * @error token-cannot-download-new-token\n\t\t\t\t */\n\t\t\t\treturn reject(\n\t\t\t\t\tnew CKEditorError( 'token-cannot-download-new-token', null )\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn resolve( xhrResponse );\n\t\t} );\n\n\t\txhr.addEventListener( 'error', () => reject( new Error( 'Network Error' ) ) );\n\t\txhr.addEventListener( 'abort', () => reject( new Error( 'Abort' ) ) );\n\n\t\txhr.send();\n\t} );\n}\n\nexport default Token;\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 cloud-services/uploadgateway/fileuploader\n */\n\n/* globals XMLHttpRequest, FormData, Blob, atob */\n\nimport { mix, EmitterMixin, CKEditorError } from 'ckeditor5/src/utils';\n\nconst BASE64_HEADER_REG_EXP = /^data:(\\S*?);base64,/;\n\n/**\n * FileUploader class used to upload single file.\n */\nexport default class FileUploader {\n\t/**\n\t * Creates `FileUploader` instance.\n\t *\n\t * @param {Blob|String} fileOrData A blob object or a data string encoded with Base64.\n\t * @param {module:cloud-services/token~Token} token Token used for authentication.\n\t * @param {String} apiAddress API address.\n\t */\n\tconstructor( fileOrData, token, apiAddress ) {\n\t\tif ( !fileOrData ) {\n\t\t\t/**\n\t\t\t * File must be provided as the first argument.\n\t\t\t *\n\t\t\t * @error fileuploader-missing-file\n\t\t\t */\n\t\t\tthrow new CKEditorError( 'fileuploader-missing-file', null );\n\t\t}\n\n\t\tif ( !token ) {\n\t\t\t/**\n\t\t\t * Token must be provided as the second argument.\n\t\t\t *\n\t\t\t * @error fileuploader-missing-token\n\t\t\t */\n\t\t\tthrow new CKEditorError( 'fileuploader-missing-token', null );\n\t\t}\n\n\t\tif ( !apiAddress ) {\n\t\t\t/**\n\t\t\t * Api address must be provided as the third argument.\n\t\t\t *\n\t\t\t * @error fileuploader-missing-api-address\n\t\t\t */\n\t\t\tthrow new CKEditorError( 'fileuploader-missing-api-address', null );\n\t\t}\n\n\t\t/**\n\t\t * A file that is being uploaded.\n\t\t *\n\t\t * @type {Blob}\n\t\t */\n\t\tthis.file = _isBase64( fileOrData ) ? _base64ToBlob( fileOrData ) : fileOrData;\n\n\t\t/**\n\t\t * CKEditor Cloud Services access token.\n\t\t *\n\t\t * @type {module:cloud-services/token~Token}\n\t\t * @private\n\t\t */\n\t\tthis._token = token;\n\n\t\t/**\n\t\t * CKEditor Cloud Services API address.\n\t\t *\n\t\t * @type {String}\n\t\t * @private\n\t\t */\n\t\tthis._apiAddress = apiAddress;\n\t}\n\n\t/**\n\t * Registers callback on `progress` event.\n\t *\n\t * @chainable\n\t * @param {Function} callback\n\t * @returns {module:cloud-services/uploadgateway/fileuploader~FileUploader}\n\t */\n\tonProgress( callback ) {\n\t\tthis.on( 'progress', ( event, data ) => callback( data ) );\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Registers callback on `error` event. Event is called once when error occurs.\n\t *\n\t * @chainable\n\t * @param {Function} callback\n\t * @returns {module:cloud-services/uploadgateway/fileuploader~FileUploader}\n\t */\n\tonError( callback ) {\n\t\tthis.once( 'error', ( event, data ) => callback( data ) );\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Aborts upload process.\n\t */\n\tabort() {\n\t\tthis.xhr.abort();\n\t}\n\n\t/**\n\t * Sends XHR request to API.\n\t *\n\t * @chainable\n\t * @returns {Promise.<Object>}\n\t */\n\tsend() {\n\t\tthis._prepareRequest();\n\t\tthis._attachXHRListeners();\n\n\t\treturn this._sendRequest();\n\t}\n\n\t/**\n\t * Prepares XHR request.\n\t *\n\t * @private\n\t */\n\t_prepareRequest() {\n\t\tconst xhr = new XMLHttpRequest();\n\n\t\txhr.open( 'POST', this._apiAddress );\n\t\txhr.setRequestHeader( 'Authorization', this._token.value );\n\t\txhr.responseType = 'json';\n\n\t\tthis.xhr = xhr;\n\t}\n\n\t/**\n\t * Attaches listeners to the XHR.\n\t *\n\t * @private\n\t */\n\t_attachXHRListeners() {\n\t\tconst that = this;\n\t\tconst xhr = this.xhr;\n\n\t\txhr.addEventListener( 'error', onError( 'Network Error' ) );\n\t\txhr.addEventListener( 'abort', onError( 'Abort' ) );\n\n\t\t/* istanbul ignore else */\n\t\tif ( xhr.upload ) {\n\t\t\txhr.upload.addEventListener( 'progress', event => {\n\t\t\t\tif ( event.lengthComputable ) {\n\t\t\t\t\tthis.fire( 'progress', {\n\t\t\t\t\t\ttotal: event.total,\n\t\t\t\t\t\tuploaded: event.loaded\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\txhr.addEventListener( 'load', () => {\n\t\t\tconst statusCode = xhr.status;\n\t\t\tconst xhrResponse = xhr.response;\n\n\t\t\tif ( statusCode < 200 || statusCode > 299 ) {\n\t\t\t\treturn this.fire( 'error', xhrResponse.message || xhrResponse.error );\n\t\t\t}\n\t\t} );\n\n\t\tfunction onError( message ) {\n\t\t\treturn () => that.fire( 'error', message );\n\t\t}\n\t}\n\n\t/**\n\t * Sends XHR request.\n\t *\n\t * @private\n\t */\n\t_sendRequest() {\n\t\tconst formData = new FormData();\n\t\tconst xhr = this.xhr;\n\n\t\tformData.append( 'file', this.file );\n\n\t\treturn new Promise( ( resolve, reject ) => {\n\t\t\txhr.addEventListener( 'load', () => {\n\t\t\t\tconst statusCode = xhr.status;\n\t\t\t\tconst xhrResponse = xhr.response;\n\n\t\t\t\tif ( statusCode < 200 || statusCode > 299 ) {\n\t\t\t\t\tif ( xhrResponse.message ) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Uploading file failed.\n\t\t\t\t\t\t *\n\t\t\t\t\t\t * @error fileuploader-uploading-data-failed\n\t\t\t\t\t\t */\n\t\t\t\t\t\treturn reject( new CKEditorError(\n\t\t\t\t\t\t\t'fileuploader-uploading-data-failed',\n\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\t{ message: xhrResponse.message }\n\t\t\t\t\t\t) );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn reject( xhrResponse.error );\n\t\t\t\t}\n\n\t\t\t\treturn resolve( xhrResponse );\n\t\t\t} );\n\n\t\t\txhr.addEventListener( 'error', () => reject( new Error( 'Network Error' ) ) );\n\t\t\txhr.addEventListener( 'abort', () => reject( new Error( 'Abort' ) ) );\n\n\t\t\txhr.send( formData );\n\t\t} );\n\t}\n\n\t/**\n\t * Fired when error occurs.\n\t *\n\t * @event error\n\t * @param {String} error Error message\n\t */\n\n\t/**\n\t * Fired on upload progress.\n\t *\n\t * @event progress\n\t * @param {Object} status Total and uploaded status\n\t */\n}\n\nmix( FileUploader, EmitterMixin );\n\n/**\n * Transforms Base64 string data into file.\n *\n * @param {String} base64 String data.\n * @param {Number} [sliceSize=512]\n * @returns {Blob}\n * @private\n */\nfunction _base64ToBlob( base64, sliceSize = 512 ) {\n\ttry {\n\t\tconst contentType = base64.match( BASE64_HEADER_REG_EXP )[ 1 ];\n\t\tconst base64Data = atob( base64.replace( BASE64_HEADER_REG_EXP, '' ) );\n\n\t\tconst byteArrays = [];\n\n\t\tfor ( let offset = 0; offset < base64Data.length; offset += sliceSize ) {\n\t\t\tconst slice = base64Data.slice( offset, offset + sliceSize );\n\t\t\tconst byteNumbers = new Array( slice.length );\n\n\t\t\tfor ( let i = 0; i < slice.length; i++ ) {\n\t\t\t\tbyteNumbers[ i ] = slice.charCodeAt( i );\n\t\t\t}\n\n\t\t\tbyteArrays.push( new Uint8Array( byteNumbers ) );\n\t\t}\n\n\t\treturn new Blob( byteArrays, { type: contentType } );\n\t} catch ( error ) {\n\t\t/**\n\t\t * Problem with decoding Base64 image data.\n\t\t *\n\t\t * @error fileuploader-decoding-image-data-error\n\t\t */\n\t\tthrow new CKEditorError( 'fileuploader-decoding-image-data-error', null );\n\t}\n}\n\n/**\n * Checks that string is Base64.\n *\n * @param {String} string\n * @returns {Boolean}\n * @private\n */\nfunction _isBase64( string ) {\n\tif ( typeof string !== 'string' ) {\n\t\treturn false;\n\t}\n\n\tconst match = string.match( BASE64_HEADER_REG_EXP );\n\treturn !!( match && match.length );\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 cloud-services/uploadgateway/uploadgateway\n */\n\nimport FileUploader from './fileuploader';\nimport { CKEditorError } from 'ckeditor5/src/utils';\n\n/**\n * UploadGateway abstracts file uploads to CKEditor Cloud Services.\n */\nexport default class UploadGateway {\n\t/**\n\t * Creates `UploadGateway` instance.\n\t *\n\t * @param {module:cloud-services/token~Token} token Token used for authentication.\n\t * @param {String} apiAddress API address.\n\t */\n\tconstructor( token, apiAddress ) {\n\t\tif ( !token ) {\n\t\t\t/**\n\t\t\t * Token must be provided.\n\t\t\t *\n\t\t\t * @error uploadgateway-missing-token\n\t\t\t */\n\t\t\tthrow new CKEditorError( 'uploadgateway-missing-token', null );\n\t\t}\n\n\t\tif ( !apiAddress ) {\n\t\t\t/**\n\t\t\t * Api address must be provided.\n\t\t\t *\n\t\t\t * @error uploadgateway-missing-api-address\n\t\t\t */\n\t\t\tthrow new CKEditorError( 'uploadgateway-missing-api-address', null );\n\t\t}\n\n\t\t/**\n\t\t * CKEditor Cloud Services access token.\n\t\t *\n\t\t * @type {module:cloud-services/token~Token}\n\t\t * @private\n\t\t */\n\t\tthis._token = token;\n\n\t\t/**\n\t\t * CKEditor Cloud Services API address.\n\t\t *\n\t\t * @type {String}\n\t\t * @private\n\t\t */\n\t\tthis._apiAddress = apiAddress;\n\t}\n\n\t/**\n\t * Creates a {@link module:cloud-services/uploadgateway/fileuploader~FileUploader} instance that wraps\n\t * file upload process. The file is being sent at a time when the\n\t * {@link module:cloud-services/uploadgateway/fileuploader~FileUploader#send} method is called.\n\t *\n\t * const token = await Token.create( 'https://token-endpoint' );\n\t * new UploadGateway( token, 'https://example.org' )\n\t * .upload( 'FILE' )\n\t * .onProgress( ( data ) => console.log( data ) )\n\t * .send()\n\t * .then( ( response ) => console.log( response ) );\n\t *\n\t * @param {Blob|String} fileOrData A blob object or a data string encoded with Base64.\n\t * @returns {module:cloud-services/uploadgateway/fileuploader~FileUploader} Returns `FileUploader` instance.\n\t */\n\tupload( fileOrData ) {\n\t\treturn new FileUploader( fileOrData, this._token, this._apiAddress );\n\t}\n}\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/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 cloud-services\n */\n\nexport { default as CloudServices } from './cloudservices';\nexport { default as CloudServicesCore } from './cloudservicescore';\n"],"names":[],"sourceRoot":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-cloud-services",
3
- "version": "39.0.2",
3
+ "version": "40.0.0",
4
4
  "description": "CKEditor 5's Cloud Services integration layer.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -11,7 +11,7 @@
11
11
  ],
12
12
  "main": "src/index.js",
13
13
  "dependencies": {
14
- "ckeditor5": "39.0.2"
14
+ "ckeditor5": "40.0.0"
15
15
  },
16
16
  "author": "CKSource (http://cksource.com/)",
17
17
  "license": "GPL-2.0-or-later",
@@ -1,19 +1,19 @@
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 { CloudServices, CloudServicesConfig, CloudServicesCore } from './index';
6
- declare module '@ckeditor/ckeditor5-core' {
7
- interface EditorConfig {
8
- /**
9
- * The configuration of CKEditor Cloud Services. Introduced by the {@link module:cloud-services/cloudservices~CloudServices} plugin.
10
- *
11
- * Read more in {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig}.
12
- */
13
- cloudServices?: CloudServicesConfig;
14
- }
15
- interface PluginsMap {
16
- [CloudServices.pluginName]: CloudServices;
17
- [CloudServicesCore.pluginName]: CloudServicesCore;
18
- }
19
- }
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 { CloudServices, CloudServicesConfig, CloudServicesCore } from './index';
6
+ declare module '@ckeditor/ckeditor5-core' {
7
+ interface EditorConfig {
8
+ /**
9
+ * The configuration of CKEditor Cloud Services. Introduced by the {@link module:cloud-services/cloudservices~CloudServices} plugin.
10
+ *
11
+ * Read more in {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig}.
12
+ */
13
+ cloudServices?: CloudServicesConfig;
14
+ }
15
+ interface PluginsMap {
16
+ [CloudServices.pluginName]: CloudServices;
17
+ [CloudServicesCore.pluginName]: CloudServicesCore;
18
+ }
19
+ }
@@ -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,84 +1,84 @@
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 cloud-services/cloudservices
7
- */
8
- import { ContextPlugin } from 'ckeditor5/src/core';
9
- import CloudServicesCore from './cloudservicescore';
10
- import type { CloudServicesConfig, TokenUrl } from './cloudservicesconfig';
11
- import type { InitializedToken } from './token/token';
12
- /**
13
- * Plugin introducing the integration between CKEditor 5 and CKEditor Cloud Services .
14
- *
15
- * It initializes the token provider based on
16
- * the {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudService`}.
17
- */
18
- export default class CloudServices extends ContextPlugin implements CloudServicesConfig {
19
- /**
20
- * The authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
21
- * {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
22
- */
23
- readonly tokenUrl?: TokenUrl;
24
- /**
25
- * The URL to which the files should be uploaded.
26
- */
27
- readonly uploadUrl?: string;
28
- /**
29
- * The URL for web socket communication, used by the `RealTimeCollaborativeEditing` plugin. Every customer (organization in the CKEditor
30
- * Ecosystem dashboard) has their own, unique URLs to communicate with CKEditor Cloud Services. The URL can be found in the
31
- * CKEditor Ecosystem customer dashboard.
32
- *
33
- * Note: Unlike most plugins, `RealTimeCollaborativeEditing` is not included in any CKEditor 5 build and needs to be installed manually.
34
- * Check [Collaboration overview](https://ckeditor.com/docs/ckeditor5/latest/features/collaboration/overview.html) for more details.
35
- */
36
- readonly webSocketUrl?: string;
37
- /**
38
- * An optional parameter used for integration with CKEditor Cloud Services when uploading the editor build to cloud services.
39
- *
40
- * Whenever the editor build or the configuration changes, this parameter should be set to a new, unique value to differentiate
41
- * the new bundle (build + configuration) from the old ones.
42
- */
43
- readonly bundleVersion?: string;
44
- /**
45
- * Other plugins use this token for the authorization process. It handles token requesting and refreshing.
46
- * Its value is `null` when {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} is not provided.
47
- *
48
- * @readonly
49
- */
50
- token: InitializedToken | null;
51
- /**
52
- * A map of token object instances keyed by the token URLs.
53
- */
54
- private readonly _tokens;
55
- /**
56
- * @inheritDoc
57
- */
58
- static get pluginName(): "CloudServices";
59
- /**
60
- * @inheritDoc
61
- */
62
- static get requires(): readonly [typeof CloudServicesCore];
63
- /**
64
- * @inheritDoc
65
- */
66
- init(): Promise<void>;
67
- /**
68
- * Registers an additional authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
69
- * {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
70
- *
71
- * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
72
- */
73
- registerTokenUrl(tokenUrl: TokenUrl): Promise<InitializedToken>;
74
- /**
75
- * Returns an authentication token provider previously registered by {@link #registerTokenUrl}.
76
- *
77
- * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
78
- */
79
- getTokenFor(tokenUrl: TokenUrl): InitializedToken;
80
- /**
81
- * @inheritDoc
82
- */
83
- destroy(): void;
84
- }
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 cloud-services/cloudservices
7
+ */
8
+ import { ContextPlugin } from 'ckeditor5/src/core';
9
+ import CloudServicesCore from './cloudservicescore';
10
+ import type { CloudServicesConfig, TokenUrl } from './cloudservicesconfig';
11
+ import type { InitializedToken } from './token/token';
12
+ /**
13
+ * Plugin introducing the integration between CKEditor 5 and CKEditor Cloud Services .
14
+ *
15
+ * It initializes the token provider based on
16
+ * the {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudService`}.
17
+ */
18
+ export default class CloudServices extends ContextPlugin implements CloudServicesConfig {
19
+ /**
20
+ * The authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
21
+ * {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
22
+ */
23
+ readonly tokenUrl?: TokenUrl;
24
+ /**
25
+ * The URL to which the files should be uploaded.
26
+ */
27
+ readonly uploadUrl?: string;
28
+ /**
29
+ * The URL for web socket communication, used by the `RealTimeCollaborativeEditing` plugin. Every customer (organization in the CKEditor
30
+ * Ecosystem dashboard) has their own, unique URLs to communicate with CKEditor Cloud Services. The URL can be found in the
31
+ * CKEditor Ecosystem customer dashboard.
32
+ *
33
+ * Note: Unlike most plugins, `RealTimeCollaborativeEditing` is not included in any CKEditor 5 build and needs to be installed manually.
34
+ * Check [Collaboration overview](https://ckeditor.com/docs/ckeditor5/latest/features/collaboration/overview.html) for more details.
35
+ */
36
+ readonly webSocketUrl?: string;
37
+ /**
38
+ * An optional parameter used for integration with CKEditor Cloud Services when uploading the editor build to cloud services.
39
+ *
40
+ * Whenever the editor build or the configuration changes, this parameter should be set to a new, unique value to differentiate
41
+ * the new bundle (build + configuration) from the old ones.
42
+ */
43
+ readonly bundleVersion?: string;
44
+ /**
45
+ * Other plugins use this token for the authorization process. It handles token requesting and refreshing.
46
+ * Its value is `null` when {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} is not provided.
47
+ *
48
+ * @readonly
49
+ */
50
+ token: InitializedToken | null;
51
+ /**
52
+ * A map of token object instances keyed by the token URLs.
53
+ */
54
+ private readonly _tokens;
55
+ /**
56
+ * @inheritDoc
57
+ */
58
+ static get pluginName(): "CloudServices";
59
+ /**
60
+ * @inheritDoc
61
+ */
62
+ static get requires(): readonly [typeof CloudServicesCore];
63
+ /**
64
+ * @inheritDoc
65
+ */
66
+ init(): Promise<void>;
67
+ /**
68
+ * Registers an additional authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
69
+ * {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
70
+ *
71
+ * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
72
+ */
73
+ registerTokenUrl(tokenUrl: TokenUrl): Promise<InitializedToken>;
74
+ /**
75
+ * Returns an authentication token provider previously registered by {@link #registerTokenUrl}.
76
+ *
77
+ * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
78
+ */
79
+ getTokenFor(tokenUrl: TokenUrl): InitializedToken;
80
+ /**
81
+ * @inheritDoc
82
+ */
83
+ destroy(): void;
84
+ }
@@ -1,103 +1,103 @@
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 cloud-services/cloudservices
7
- */
8
- import { ContextPlugin } from 'ckeditor5/src/core';
9
- import { CKEditorError } from 'ckeditor5/src/utils';
10
- import CloudServicesCore from './cloudservicescore';
11
- /**
12
- * Plugin introducing the integration between CKEditor 5 and CKEditor Cloud Services .
13
- *
14
- * It initializes the token provider based on
15
- * the {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudService`}.
16
- */
17
- export default class CloudServices extends ContextPlugin {
18
- constructor() {
19
- super(...arguments);
20
- /**
21
- * Other plugins use this token for the authorization process. It handles token requesting and refreshing.
22
- * Its value is `null` when {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} is not provided.
23
- *
24
- * @readonly
25
- */
26
- this.token = null;
27
- /**
28
- * A map of token object instances keyed by the token URLs.
29
- */
30
- this._tokens = new Map();
31
- }
32
- /**
33
- * @inheritDoc
34
- */
35
- static get pluginName() {
36
- return 'CloudServices';
37
- }
38
- /**
39
- * @inheritDoc
40
- */
41
- static get requires() {
42
- return [CloudServicesCore];
43
- }
44
- /**
45
- * @inheritDoc
46
- */
47
- async init() {
48
- const config = this.context.config;
49
- const options = config.get('cloudServices') || {};
50
- for (const [key, value] of Object.entries(options)) {
51
- this[key] = value;
52
- }
53
- if (!this.tokenUrl) {
54
- this.token = null;
55
- return;
56
- }
57
- const cloudServicesCore = this.context.plugins.get('CloudServicesCore');
58
- this.token = await cloudServicesCore.createToken(this.tokenUrl).init();
59
- this._tokens.set(this.tokenUrl, this.token);
60
- }
61
- /**
62
- * Registers an additional authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
63
- * {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
64
- *
65
- * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
66
- */
67
- async registerTokenUrl(tokenUrl) {
68
- // Reuse the token instance in case of multiple features using the same token URL.
69
- if (this._tokens.has(tokenUrl)) {
70
- return this.getTokenFor(tokenUrl);
71
- }
72
- const cloudServicesCore = this.context.plugins.get('CloudServicesCore');
73
- const token = await cloudServicesCore.createToken(tokenUrl).init();
74
- this._tokens.set(tokenUrl, token);
75
- return token;
76
- }
77
- /**
78
- * Returns an authentication token provider previously registered by {@link #registerTokenUrl}.
79
- *
80
- * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
81
- */
82
- getTokenFor(tokenUrl) {
83
- const token = this._tokens.get(tokenUrl);
84
- if (!token) {
85
- /**
86
- * The provided `tokenUrl` was not registered by {@link module:cloud-services/cloudservices~CloudServices#registerTokenUrl}.
87
- *
88
- * @error cloudservices-token-not-registered
89
- */
90
- throw new CKEditorError('cloudservices-token-not-registered', this);
91
- }
92
- return token;
93
- }
94
- /**
95
- * @inheritDoc
96
- */
97
- destroy() {
98
- super.destroy();
99
- for (const token of this._tokens.values()) {
100
- token.destroy();
101
- }
102
- }
103
- }
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 cloud-services/cloudservices
7
+ */
8
+ import { ContextPlugin } from 'ckeditor5/src/core';
9
+ import { CKEditorError } from 'ckeditor5/src/utils';
10
+ import CloudServicesCore from './cloudservicescore';
11
+ /**
12
+ * Plugin introducing the integration between CKEditor 5 and CKEditor Cloud Services .
13
+ *
14
+ * It initializes the token provider based on
15
+ * the {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudService`}.
16
+ */
17
+ export default class CloudServices extends ContextPlugin {
18
+ constructor() {
19
+ super(...arguments);
20
+ /**
21
+ * Other plugins use this token for the authorization process. It handles token requesting and refreshing.
22
+ * Its value is `null` when {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} is not provided.
23
+ *
24
+ * @readonly
25
+ */
26
+ this.token = null;
27
+ /**
28
+ * A map of token object instances keyed by the token URLs.
29
+ */
30
+ this._tokens = new Map();
31
+ }
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ static get pluginName() {
36
+ return 'CloudServices';
37
+ }
38
+ /**
39
+ * @inheritDoc
40
+ */
41
+ static get requires() {
42
+ return [CloudServicesCore];
43
+ }
44
+ /**
45
+ * @inheritDoc
46
+ */
47
+ async init() {
48
+ const config = this.context.config;
49
+ const options = config.get('cloudServices') || {};
50
+ for (const [key, value] of Object.entries(options)) {
51
+ this[key] = value;
52
+ }
53
+ if (!this.tokenUrl) {
54
+ this.token = null;
55
+ return;
56
+ }
57
+ const cloudServicesCore = this.context.plugins.get('CloudServicesCore');
58
+ this.token = await cloudServicesCore.createToken(this.tokenUrl).init();
59
+ this._tokens.set(this.tokenUrl, this.token);
60
+ }
61
+ /**
62
+ * Registers an additional authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
63
+ * {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
64
+ *
65
+ * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
66
+ */
67
+ async registerTokenUrl(tokenUrl) {
68
+ // Reuse the token instance in case of multiple features using the same token URL.
69
+ if (this._tokens.has(tokenUrl)) {
70
+ return this.getTokenFor(tokenUrl);
71
+ }
72
+ const cloudServicesCore = this.context.plugins.get('CloudServicesCore');
73
+ const token = await cloudServicesCore.createToken(tokenUrl).init();
74
+ this._tokens.set(tokenUrl, token);
75
+ return token;
76
+ }
77
+ /**
78
+ * Returns an authentication token provider previously registered by {@link #registerTokenUrl}.
79
+ *
80
+ * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
81
+ */
82
+ getTokenFor(tokenUrl) {
83
+ const token = this._tokens.get(tokenUrl);
84
+ if (!token) {
85
+ /**
86
+ * The provided `tokenUrl` was not registered by {@link module:cloud-services/cloudservices~CloudServices#registerTokenUrl}.
87
+ *
88
+ * @error cloudservices-token-not-registered
89
+ */
90
+ throw new CKEditorError('cloudservices-token-not-registered', this);
91
+ }
92
+ return token;
93
+ }
94
+ /**
95
+ * @inheritDoc
96
+ */
97
+ destroy() {
98
+ super.destroy();
99
+ for (const token of this._tokens.values()) {
100
+ token.destroy();
101
+ }
102
+ }
103
+ }