8
0
فهرست منبع

Remove setting min-width class for balloontoolbar and related test as well

panr 6 سال پیش
والد
کامیت
096c665ffa

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

@@ -191,24 +191,11 @@ export default class BalloonToolbar extends Plugin {
 	_createToolbarView() {
 	_createToolbarView() {
 		const shouldGroupWhenFull = !this._balloonConfig.shouldNotGroupWhenFull;
 		const shouldGroupWhenFull = !this._balloonConfig.shouldNotGroupWhenFull;
 		const toolbarView = new ToolbarView( this.editor.locale, { shouldGroupWhenFull } );
 		const toolbarView = new ToolbarView( this.editor.locale, { shouldGroupWhenFull } );
-		const balloonToolbarPlugins = this.editor.config.get( 'balloonToolbar' );
-		const bind = toolbarView.bindTemplate;
 
 
 		toolbarView.extendTemplate( {
 		toolbarView.extendTemplate( {
 			attributes: {
 			attributes: {
 				class: [
 				class: [
 					'ck-toolbar_floating',
 					'ck-toolbar_floating',
-					// When balloon toolbar contains `heading` plugin and the width of the editable is narrower than 200px,
-					// the balloon may fold too "agressively" and not show any of the buttons (only "three dots" button is visible
-					// to trigger dropdown menu with buttons that don't fit the toolbar width boundary).
-					//
-					// This is a workaround for the case. By default `ck-balloon-toolbar_min-width` class sets static `min-width` to 180px.
-					// The value matches a dynamic value (90% of the editable width) set by ResizeObserver's callback during initialization.
-					bind.if( 'maxWidth', 'ck-balloon-toolbar_min-width', value => {
-						if ( parseFloat( value ) <= 200 ) {
-							return balloonToolbarPlugins.find( plugin => plugin === 'heading' );
-						}
-					} )
 				]
 				]
 			}
 			}
 		} );
 		} );

+ 1 - 32
packages/ckeditor5-ui/tests/toolbar/balloon/balloontoolbar.js

@@ -12,7 +12,6 @@ import FocusTracker from '@ckeditor/ckeditor5-utils/src/focustracker';
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
 import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
 import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
 import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
 import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
-import Heading from '@ckeditor/ckeditor5-heading/src/heading';
 import Underline from '@ckeditor/ckeditor5-basic-styles/src/underline';
 import Underline from '@ckeditor/ckeditor5-basic-styles/src/underline';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import global from '@ckeditor/ckeditor5-utils/src/dom/global';
 import global from '@ckeditor/ckeditor5-utils/src/dom/global';
@@ -28,7 +27,7 @@ const toPx = toUnit( 'px' );
 
 
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 
 
-/* global document, window, Event, setTimeout */
+/* global document, window, Event */
 
 
 describe( 'BalloonToolbar', () => {
 describe( 'BalloonToolbar', () => {
 	let editor, model, selection, editingView, balloonToolbar, balloon, editorElement;
 	let editor, model, selection, editingView, balloonToolbar, balloon, editorElement;
@@ -628,36 +627,6 @@ describe( 'BalloonToolbar', () => {
 		} );
 		} );
 	} );
 	} );
 
 
-	describe( 'has `Heading` plugin and editable width is less then 200px', () => {
-		let editor, balloonToolbar, viewElement;
-
-		beforeEach( () => {
-			return ClassicTestEditor.create( editorElement, {
-				plugins: [ Heading, BalloonToolbar ],
-				balloonToolbar: [ 'heading' ]
-			} ).then( newEditor => {
-				editor = newEditor;
-				balloonToolbar = editor.plugins.get( 'BalloonToolbar' );
-				viewElement = editor.ui.view.editable.element;
-			} );
-		} );
-
-		afterEach( () => {
-			editor.destroy();
-		} );
-
-		it( 'should contain `.ck-balloon-toolbar_min-width`', done => {
-			viewElement.style.width = '200px';
-
-			// We have to wait for a ResizeObserver to set the editable's width.
-			setTimeout( () => {
-				expect( balloonToolbar.toolbarView.element.classList.contains( 'ck-balloon-toolbar_min-width' ) ).to.be.true;
-
-				done();
-			}, 200 );
-		} );
-	} );
-
 	function stubSelectionRects( rects ) {
 	function stubSelectionRects( rects ) {
 		const originalViewRangeToDom = editingView.domConverter.viewRangeToDom;
 		const originalViewRangeToDom = editingView.domConverter.viewRangeToDom;