Browse Source

Add label to normalization function. Provide default editor's label.

Mateusz Samsel 6 years ago
parent
commit
9827e27dd4

+ 2 - 0
packages/ckeditor5-ui/src/toolbar/balloon/balloontoolbar.js

@@ -138,6 +138,8 @@ export default class BalloonToolbar extends Plugin {
 		const factory = this.editor.ui.componentFactory;
 
 		this.toolbarView.fillFromConfig( config.items, factory );
+
+		this.toolbarView.label = this.editor.t( config.label );
 	}
 
 	/**

+ 8 - 3
packages/ckeditor5-ui/src/toolbar/normalizetoolbarconfig.js

@@ -29,19 +29,24 @@
  * @returns {Object} A normalized toolbar config object.
  */
 export default function normalizeToolbarConfig( config ) {
+	const defaultLabel = 'Editor\'s toolbar';
+
 	if ( Array.isArray( config ) ) {
 		return {
-			items: config
+			items: config,
+			label: defaultLabel
 		};
 	}
 
 	if ( !config ) {
 		return {
-			items: []
+			items: [],
+			label: defaultLabel
 		};
 	}
 
 	return Object.assign( {
-		items: []
+		items: [],
+		label: defaultLabel
 	}, config );
 }