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

Add stub test for non-rectangular selection is pasted.

Maciej Gołaszewski 5 лет назад
Родитель
Сommit
448e61c54f

+ 0 - 4
packages/ckeditor5-table/src/tableclipboard.js

@@ -92,10 +92,6 @@ export default class TableClipboard extends Plugin {
 	 * This param defines a position in relation to that item.
 	 */
 	_onInsertContent( evt, content ) {
-		if ( this.editor.isReadOnly ) {
-			return;
-		}
-
 		const tableSelection = this.editor.plugins.get( 'TableSelection' );
 		const selectedTableCells = tableSelection.getSelectedTableCells();
 

+ 26 - 0
packages/ckeditor5-table/tests/tableclipboard.js

@@ -476,6 +476,32 @@ describe( 'table clipboard', () => {
 				] ) );
 			} );
 
+			describe( 'single cell selected', () => {
+				it( 'blocks this case', () => {
+					setModelData( model, modelTable( [
+						[ '00', '01', '02' ],
+						[ '10', '11', '12' ],
+						[ '20', '21', '22' ]
+					] ) );
+
+					tableSelection.setCellSelection(
+						modelRoot.getNodeByPath( [ 0, 0, 0 ] ),
+						modelRoot.getNodeByPath( [ 0, 0, 0 ] )
+					);
+
+					pasteTable( [
+						[ 'aa', 'ab' ],
+						[ 'ba', 'bb' ]
+					] );
+
+					assertEqualMarkup( getModelData( model, { withoutSelection: true } ), modelTable( [
+						[ '00', '01', '02' ],
+						[ '10', '11', '12' ],
+						[ '20', '21', '22' ]
+					] ) );
+				} );
+			} );
+
 			describe( 'pasted table is equal to the selected area', () => {
 				describe( 'no spans', () => {
 					it( 'handles simple table paste to a simple table fragment - at the beginning of a table', () => {