Преглед изворни кода

Merge branch 'master' into i/6521

Maciej Gołaszewski пре 5 година
родитељ
комит
24418c96bc

+ 2 - 11
packages/ckeditor5-table/src/tableui.js

@@ -278,19 +278,10 @@ export default class TableUI extends Plugin {
 		dropdownView.buttonView.set( {
 			label,
 			icon,
-			tooltip: true
+			tooltip: true,
+			isEnabled: true
 		} );
 
-		// The main part of the split button is bound to the "mergeTableCells" command only.
-		dropdownView.bind( 'isEnabled' ).to( editor.commands.get( mergeCommandName ) );
-
-		// The split button dropdown must be **always** enabled and ready to open no matter the state
-		// of the "mergeTableCells" command. You may not be able to merge multiple cells but you may want
-		// to split them. This is also about mobile devices where multi–cell selection will never work
-		// (that's why "Merge cell right", "Merge cell down", etc. are still there in the first place).
-		dropdownView.buttonView.arrowView.unbind( 'isEnabled' );
-		dropdownView.buttonView.arrowView.isEnabled = true;
-
 		// Merge selected table cells when the main part of the split button is clicked.
 		this.listenTo( dropdownView.buttonView, 'execute', () => {
 			editor.execute( mergeCommandName );

+ 0 - 19
packages/ckeditor5-table/tests/converters/downcast.js

@@ -7,7 +7,6 @@ import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtest
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 
 import TableEditing from '../../src/tableediting';
-import env from '@ckeditor/ckeditor5-utils/src/env';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 import { setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
@@ -47,9 +46,6 @@ describe( 'downcast converters', () => {
 	describe( 'downcastInsertTable()', () => {
 		// The beforeEach is duplicated due to ckeditor/ckeditor5#6574. New test are written using TableEditing.
 		beforeEach( () => {
-			// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
-			testUtils.sinon.stub( env, 'isEdge' ).get( () => false );
-
 			return VirtualTestEditor.create()
 				.then( newEditor => {
 					editor = newEditor;
@@ -360,9 +356,6 @@ describe( 'downcast converters', () => {
 	describe( 'downcastInsertRow()', () => {
 		// The beforeEach is duplicated due to ckeditor/ckeditor5#6574. New test are written using TableEditing.
 		beforeEach( () => {
-			// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
-			testUtils.sinon.stub( env, 'isEdge' ).get( () => false );
-
 			return VirtualTestEditor.create()
 				.then( newEditor => {
 					editor = newEditor;
@@ -615,9 +608,6 @@ describe( 'downcast converters', () => {
 	describe( 'downcastInsertCell()', () => {
 		// The beforeEach is duplicated due to ckeditor/ckeditor5#6574. New test are written using TableEditing.
 		beforeEach( () => {
-			// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
-			testUtils.sinon.stub( env, 'isEdge' ).get( () => false );
-
 			return VirtualTestEditor.create()
 				.then( newEditor => {
 					editor = newEditor;
@@ -777,9 +767,6 @@ describe( 'downcast converters', () => {
 	describe( 'downcastTableHeadingColumnsChange()', () => {
 		// The beforeEach is duplicated due to ckeditor/ckeditor5#6574. New test are written using TableEditing.
 		beforeEach( () => {
-			// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
-			testUtils.sinon.stub( env, 'isEdge' ).get( () => false );
-
 			return VirtualTestEditor.create()
 				.then( newEditor => {
 					editor = newEditor;
@@ -971,9 +958,6 @@ describe( 'downcast converters', () => {
 	describe( 'downcastTableHeadingRowsChange()', () => {
 		// The beforeEach is duplicated due to ckeditor/ckeditor5#6574. New test are written using TableEditing.
 		beforeEach( () => {
-			// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
-			testUtils.sinon.stub( env, 'isEdge' ).get( () => false );
-
 			return VirtualTestEditor.create( { plugins: [ Paragraph, TableEditing ] } )
 				.then( newEditor => {
 					editor = newEditor;
@@ -1196,9 +1180,6 @@ describe( 'downcast converters', () => {
 	describe( 'downcastRemoveRow()', () => {
 		// The beforeEach is duplicated due to ckeditor/ckeditor5#6574. New test are written using TableEditing.
 		beforeEach( async () => {
-			// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
-			testUtils.sinon.stub( env, 'isEdge' ).get( () => false );
-
 			editor = await VirtualTestEditor.create( { plugins: [ Paragraph, TableEditing ] } );
 
 			model = editor.model;

+ 0 - 4
packages/ckeditor5-table/tests/converters/table-cell-refresh-post-fixer.js

@@ -10,7 +10,6 @@ import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils
 import { defaultConversion, defaultSchema, viewTable } from '../_utils/utils';
 import injectTableCellRefreshPostFixer from '../../src/converters/table-cell-refresh-post-fixer';
 
-import env from '@ckeditor/ckeditor5-utils/src/env';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
 
@@ -26,9 +25,6 @@ describe( 'Table cell refresh post-fixer', () => {
 		element = document.createElement( 'div' );
 		document.body.appendChild( element );
 
-		// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
-		testUtils.sinon.stub( env, 'isEdge' ).get( () => false );
-
 		return ClassicTestEditor.create( element, { extraPlugins: [ Delete ] } )
 			.then( newEditor => {
 				editor = newEditor;

+ 0 - 1
packages/ckeditor5-table/tests/converters/upcasttable.js

@@ -204,7 +204,6 @@ describe( 'upcastTable()', () => {
 	} );
 
 	it( 'should fix if inside other blocks', () => {
-		// Using <div> instead of <p> as it breaks on Edge.
 		editor.model.schema.register( 'div', {
 			inheritAllFrom: '$block'
 		} );

+ 2 - 2
packages/ckeditor5-table/tests/tableui.js

@@ -386,9 +386,9 @@ describe( 'TableUI', () => {
 			expect( dropdown.buttonView ).to.be.instanceOf( SplitButtonView );
 		} );
 
-		it( 'should bind #isEnabled to the "mergeTableCells" command', () => {
+		it( 'should have #isEnabled always true regardless of the "mergeTableCells" command state', () => {
 			command.isEnabled = false;
-			expect( dropdown.isEnabled ).to.be.false;
+			expect( dropdown.isEnabled ).to.be.true;
 
 			command.isEnabled = true;
 			expect( dropdown.isEnabled ).to.be.true;