Jelajahi Sumber

Fixed previousCellInRow.

Kuba Niegowski 5 tahun lalu
induk
melakukan
e9efea1c42

+ 3 - 3
packages/ckeditor5-table/src/tablewalker.js

@@ -258,11 +258,11 @@ export default class TableWalker {
 				this._recordSpans( rowspan, colspan, cell );
 			}
 
-			this._nextCellAtColumn = this._column + colspan;
-			this._previousCellInRow = cell;
-
 			skipCurrentValue = this._shouldSkipRow() || this._shouldSkipColumn();
 			outValue = this._formatOutValue( cell, null, rowspan, colspan );
+
+			this._nextCellAtColumn = this._column + colspan;
+			this._previousCellInRow = cell;
 		}
 
 		// Advance to the next column before returning value.

+ 6 - 14
packages/ckeditor5-table/tests/_utils/utils.js

@@ -519,25 +519,17 @@ export function createTableAsciiArt( model, table ) {
 		for ( let column = 0; column <= lastColumn; column++ ) {
 			const cellInfo = tableMap[ row * columns + column ];
 
-			if ( cellInfo.rowspan > 1 || cellInfo.colspan > 1 ) {
-				for ( let subRow = row; subRow < row + cellInfo.rowspan; subRow++ ) {
-					for ( let subColumn = column; subColumn < column + cellInfo.colspan; subColumn++ ) {
-						const subCellInfo = tableMap[ subRow * columns + subColumn ];
+			const isColSpan = cellInfo.anchorColumn != cellInfo.column;
+			const isRowSpan = cellInfo.anchorRow != cellInfo.row;
 
-						subCellInfo.isColSpan = subColumn > column;
-						subCellInfo.isRowSpan = subRow > row;
-					}
-				}
-			}
-
-			gridLine += !cellInfo.isColSpan || !cellInfo.isRowSpan ? '+' : ' ';
-			gridLine += !cellInfo.isRowSpan ? '----' : '    ';
+			gridLine += !isColSpan || !isRowSpan ? '+' : ' ';
+			gridLine += !isRowSpan ? '----' : '    ';
 
 			let contents = getElementPlainText( model, cellInfo.cell ).substring( 0, 2 );
 			contents += ' '.repeat( 2 - contents.length );
 
-			contentLine += !cellInfo.isColSpan ? '|' : ' ';
-			contentLine += !cellInfo.isColSpan && !cellInfo.isRowSpan ? ` ${ contents } ` : '    ';
+			contentLine += !isColSpan ? '|' : ' ';
+			contentLine += !isColSpan && !isRowSpan ? ` ${ contents } ` : '    ';
 
 			if ( column == lastColumn ) {
 				gridLine += '+';