8
0
Просмотр исходного кода

Moved creation of the toolbar view to the separate method.

Oskar Wróbel 7 лет назад
Родитель
Сommit
3cf46976d4
1 измененных файлов с 21 добавлено и 11 удалено
  1. 21 11
      packages/ckeditor5-ui/src/toolbar/balloon/balloontoolbar.js

+ 21 - 11
packages/ckeditor5-ui/src/toolbar/balloon/balloontoolbar.js

@@ -48,17 +48,7 @@ export default class BalloonToolbar extends Plugin {
 		 *
 		 * @member {module:ui/toolbar/toolbarview~ToolbarView}
 		 */
-		this.toolbarView = new ToolbarView( editor.locale );
-
-		this.toolbarView.extendTemplate( {
-			attributes: {
-				class: [
-					'ck-toolbar_floating'
-				]
-			}
-		} );
-
-		this.toolbarView.render();
+		this.toolbarView = this._createToolbarView();
 
 		/**
 		 * The contextual balloon plugin instance.
@@ -101,6 +91,26 @@ export default class BalloonToolbar extends Plugin {
 		this.toolbarView.fillFromConfig( config.items, factory );
 	}
 
+	/**
+	 * Creates the toolbar view instance.
+	 *
+	 * @private
+	 * @returns {module:ui/toolbar/toolbarview~ToolbarView}
+	 */
+	_createToolbarView() {
+		const toolbarView = new ToolbarView( this.editor.locale );
+
+		toolbarView.extendTemplate( {
+			attributes: {
+				class: [ 'ck-toolbar_floating' ]
+			}
+		} );
+
+		toolbarView.render();
+
+		return toolbarView;
+	}
+
 	/**
 	 * Handles the editor focus change and hides the toolbar if it's needed.
 	 *