diff --git a/src/cloudservicesuploadadapter.js b/src/cloudservicesuploadadapter.js index 2139618..0f4690d 100644 --- a/src/cloudservicesuploadadapter.js +++ b/src/cloudservicesuploadadapter.js @@ -41,6 +41,10 @@ export default class CloudServicesUploadAdapter extends Plugin { const token = cloudServices.token; const uploadUrl = cloudServices.uploadUrl || 'https://files.cke-cs.com/upload/'; + if ( !token ) { + return; + } + this._uploadGateway = new CloudServicesUploadAdapter._UploadGateway( token, uploadUrl ); editor.plugins.get( FileRepository ).createAdapter = loader => { diff --git a/tests/cloudservicesuploadadapter.js b/tests/cloudservicesuploadadapter.js index 4980a2d..1998fe1 100644 --- a/tests/cloudservicesuploadadapter.js +++ b/tests/cloudservicesuploadadapter.js @@ -60,6 +60,20 @@ describe( 'CloudServicesUploadAdapter', () => { } ); } ); + it( 'should not set loader if there is no token', () => { + UploadGatewayMock.lastToken = undefined; + + return ClassicTestEditor + .create( div, { + plugins: [ CloudServicesUploadAdapter ] + } ) + .then( editor => { + expect( UploadGatewayMock.lastToken ).to.be.undefined; + + return editor.destroy(); + } ); + } ); + it( 'should set the default uploadUrl', () => { const expectedDefaultUrl = 'https://files.cke-cs.com/upload/';