Sfoglia il codice sorgente

Changed init/append order.

Piotrek Koszuliński 10 anni fa
parent
commit
cb18f61c4f
1 ha cambiato i file con 8 aggiunte e 6 eliminazioni
  1. 8 6
      packages/ckeditor5-engine/src/ui/controller.js

+ 8 - 6
packages/ckeditor5-engine/src/ui/controller.js

@@ -39,6 +39,13 @@ CKEDITOR.define( [ 'collection', 'model' ], function( Collection, Model ) {
 			return Promise.resolve()
 				.then( () => {
 					return this.view.init();
+				} )
+				.then( () => {
+					let promises = [];
+
+					this.controllers.forEach( item => promises.push( item.init() ) );
+
+					return Promise.all( promises );
 				} );
 		}
 
@@ -52,13 +59,8 @@ CKEDITOR.define( [ 'collection', 'model' ], function( Collection, Model ) {
 			// Note: Because controller.init() can by sync as well as async,
 			// it is wrapped in promise.
 			return Promise.resolve()
-				.then( () => {
-					return controller.init();
-				} )
 				.then( this.view.append.bind( this.view, controller.view, regionName ) )
-				.then( () => {
-					return controller;
-				} );
+				.then( () => controller );
 		}
 
 		/**