Browse Source

Used the enableWrappedItemsGroupping method to enable items groupping in the main toolbar when the space is scarce.

Aleksander Nowodzinski 7 years ago
parent
commit
69ea3a4d7a
1 changed files with 11 additions and 1 deletions
  1. 11 1
      packages/ckeditor5-editor-classic/src/classiceditorui.js

+ 11 - 1
packages/ckeditor5-editor-classic/src/classiceditorui.js

@@ -57,7 +57,17 @@ export default class ClassicEditorUI extends EditorUI {
 
 		this.focusTracker.add( this.view.editableElement );
 
-		this.view.toolbar.fillFromConfig( this._toolbarConfig.items, this.componentFactory );
+		view.toolbar.fillFromConfig( this._toolbarConfig.items, this.componentFactory );
+
+		editor.on( 'ready', () => {
+			// This feature should not be enabled earlier because for the algorithm to work,
+			// the toolbar must be visible in DOM (i.e. only after #uiReady).
+			// But that's not all: the editor content must also be ready because loading it into
+			// editable can make the vertical website scrollbar to show up (it is usually styled
+			// differently in the website and in the editor; it can "grow" a lot). And that would
+			// reduce the horizontal space available for toolbar items. In other words, later is better.
+			view.toolbar.enableWrappedItemsGroupping();
+		} );
 
 		enableToolbarKeyboardFocus( {
 			origin: editor.editing.view,