浏览代码

Internal: Fixed an issue where remove row command would be enabled when entire column was selected.

Marek Lewandowski 5 年之前
父节点
当前提交
20af88e944
共有 2 个文件被更改,包括 3 次插入6 次删除
  1. 2 5
      packages/ckeditor5-table/src/tableutils.js
  2. 1 1
      packages/ckeditor5-table/tests/tableutils.js

+ 2 - 5
packages/ckeditor5-table/src/tableutils.js

@@ -560,11 +560,8 @@ export default class TableUtils extends Plugin {
 	 * @returns {Number}
 	 */
 	getRows( table ) {
-		return [ ...table.getChildren() ].reduce( ( rows, row ) => {
-			const currentRowCount = parseInt( row.getChild( 0 ).getAttribute( 'rowspan' ) || 1 );
-
-			return rows + currentRowCount;
-		}, 0 );
+		// Simple row counting, not including rowspan due to #6427.
+		return table.childCount;
 	}
 }
 

+ 1 - 1
packages/ckeditor5-table/tests/tableutils.js

@@ -726,7 +726,7 @@ describe( 'TableUtils', () => {
 				[ '21' ]
 			] ) );
 
-			expect( tableUtils.getRows( root.getNodeByPath( [ 0 ] ) ) ).to.equal( 4 );
+			expect( tableUtils.getRows( root.getNodeByPath( [ 0 ] ) ) ).to.equal( 3 );
 		} );
 	} );
 } );