Ver código fonte

Merge branch 'master' into context

Szymon Cofalik 6 anos atrás
pai
commit
2ff48fc99c

+ 4 - 0
packages/ckeditor5-cloud-services/.editorconfig

@@ -10,3 +10,7 @@ charset = utf-8
 end_of_line = lf
 trim_trailing_whitespace = true
 insert_final_newline = true
+
+[package.json]
+indent_style = space
+tab_width = 2

+ 1 - 1
packages/ckeditor5-cloud-services/.eslintrc.js

@@ -1,5 +1,5 @@
 /**
- * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  */
 

+ 1 - 1
packages/ckeditor5-cloud-services/LICENSE.md

@@ -2,7 +2,7 @@ Software License Agreement
 ==========================
 
 **CKEditor 5 Cloud Services** – https://github.com/ckeditor/ckeditor5-cloud-services <br>
-Copyright (c) 2003-2019, [CKSource](http://cksource.com) Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2020, [CKSource](http://cksource.com) Frederico Knabben. All rights reserved.
 
 Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
 

+ 10 - 1
packages/ckeditor5-cloud-services/src/cloudservices.js

@@ -1,5 +1,5 @@
 /**
- * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  */
 
@@ -185,6 +185,15 @@ CloudServices.Token = Token;
  * @member {String} module:cloud-services/cloudservices~CloudServicesConfig#webSocketUrl
  */
 
+/**
+ * Optional parameter used for integration with Cloud Services, when uploading the editor build to Cloud Services.
+ *
+ * Whenever the editor build or the configuration changes, this parameter should be set to a new, unique value, to differentiate
+ * the new bundle (build + configuration) from the old ones.
+ *
+ * @member {String} module:cloud-services/cloudservices~CloudServicesConfig#bundleVersion
+ */
+
 /**
  * Document ID, used by the `RealTimeCollaborativeEditing` plugin. All editor instances created with the same document ID will collaborate.
  * It means that each document needs a different document ID if you do not want to start collaboration between these documents.

+ 1 - 1
packages/ckeditor5-cloud-services/tests/_utils/cloud-services-config.js

@@ -1,5 +1,5 @@
 /**
- * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  */
 

+ 1 - 1
packages/ckeditor5-cloud-services/tests/_utils/tokenmock.js

@@ -1,5 +1,5 @@
 /**
- * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  */
 

+ 26 - 20
packages/ckeditor5-cloud-services/tests/cloudservices.js

@@ -1,5 +1,5 @@
 /**
- * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  */
 
@@ -36,14 +36,14 @@ describe( 'CloudServices', () => {
 						additionalOption: 'some-value'
 					}
 				} )
-				.then( editor => {
-					const cloudServicesPlugin = editor.plugins.get( CloudServices );
+				.then( context => {
+					const cloudServicesPlugin = context.plugins.get( CloudServices );
 
 					expect( cloudServicesPlugin ).to.be.instanceOf( CloudServices );
 					expect( cloudServicesPlugin.tokenUrl ).to.equal( 'http://token-endpoint' );
 					expect( cloudServicesPlugin.additionalOption ).to.equal( 'some-value' );
 
-					return editor.destroy();
+					return context.destroy();
 				} );
 		} );
 
@@ -57,32 +57,34 @@ describe( 'CloudServices', () => {
 					}
 				} )
 				.then( editor => {
-					const cloudServicesPlugin = editor.plugins.get( CloudServices );
-
+					const cloudServicesPlugin = editor.plugins.get( 'CloudServices' );
 					expect( cloudServicesPlugin ).to.be.instanceOf( CloudServices );
-					expect( cloudServicesPlugin.tokenUrl ).to.equal( 'http://token-endpoint' );
-					expect( cloudServicesPlugin.additionalOption ).to.equal( 'some-value' );
 
 					return editor.destroy();
 				} );
 		} );
 
 		it( 'should be able to get by its plugin name', () => {
-			return Context.create( { plugins: [ CloudServices ] } ).then( editor => {
-				const cloudServicesPlugin = editor.plugins.get( 'CloudServices' );
+			return Context.create( { plugins: [ CloudServices ] } ).then( context => {
+				const cloudServicesPlugin = context.plugins.get( 'CloudServices' );
+
 				expect( cloudServicesPlugin ).to.be.instanceOf( CloudServices );
+
+				return context.destroy();
 			} );
 		} );
 
 		it( 'should not throw an error when no config is provided', () => {
-			return Context.create( { plugins: [ CloudServices ] } );
+			return Context.create( { plugins: [ CloudServices ] } ).then( context => context.destroy() );
 		} );
 
 		it( 'should not expose any default uploadUrl', () => {
-			return Context.create( { plugins: [ CloudServices ] } ).then( editor => {
-				const cloudServicesPlugin = editor.plugins.get( CloudServices );
+			return Context.create( { plugins: [ CloudServices ] } ).then( context => {
+				const cloudServicesPlugin = context.plugins.get( CloudServices );
 
 				expect( cloudServicesPlugin.uploadUrl ).to.be.undefined;
+
+				return context.destroy();
 			} );
 		} );
 
@@ -94,10 +96,12 @@ describe( 'CloudServices', () => {
 						uploadUrl: 'https://some-upload-url/'
 					}
 				} )
-				.then( editor => {
-					const cloudServicesPlugin = editor.plugins.get( CloudServices );
+				.then( context => {
+					const cloudServicesPlugin = context.plugins.get( CloudServices );
 
 					expect( cloudServicesPlugin.uploadUrl ).to.equal( 'https://some-upload-url/' );
+
+					return context.destroy();
 				} );
 		} );
 
@@ -111,22 +115,24 @@ describe( 'CloudServices', () => {
 						tokenUrl: 'http://token-endpoint',
 					}
 				} )
-				.then( editor => {
-					const cloudServicesPlugin = editor.plugins.get( CloudServices );
+				.then( context => {
+					const cloudServicesPlugin = context.plugins.get( CloudServices );
 
 					expect( cloudServicesPlugin.token.value ).to.equal( 'initial-token' );
 
-					return editor.destroy();
+					return context.destroy();
 				} );
 		} );
 
 		it( 'should not provide token if tokenUrl is not provided', () => {
 			CloudServices.Token.initialToken = 'initial-token';
 
-			return Context.create( { plugins: [ CloudServices ] } ).then( editor => {
-				const cloudServicesPlugin = editor.plugins.get( CloudServices );
+			return Context.create( { plugins: [ CloudServices ] } ).then( context => {
+				const cloudServicesPlugin = context.plugins.get( CloudServices );
 
 				expect( cloudServicesPlugin.token ).to.equal( null );
+
+				return context.destroy();
 			} );
 		} );
 	} );

+ 1 - 1
packages/ckeditor5-cloud-services/tests/manual/token.js

@@ -1,5 +1,5 @@
 /**
- * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  */