|
@@ -214,16 +214,25 @@ export default class TableEditing extends Plugin {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const isLastCellInRow = currentCellIndex === tableRow.childCount - 1;
|
|
const isLastCellInRow = currentCellIndex === tableRow.childCount - 1;
|
|
|
- const isLastRow = currentRowIndex === table.childCount - 1;
|
|
|
|
|
|
|
+ let isLastRow = currentRowIndex === table.childCount - 1;
|
|
|
|
|
|
|
|
if ( isForward && isLastRow && isLastCellInRow ) {
|
|
if ( isForward && isLastRow && isLastCellInRow ) {
|
|
|
- editor.plugins.get( 'TableUtils' ).insertRows( table, { at: table.childCount } );
|
|
|
|
|
|
|
+ editor.execute( 'insertTableRowBelow' );
|
|
|
|
|
+
|
|
|
|
|
+ // Re-evaluate `isLastRow`. If `insertTableRowBelow` execution didn't add any row (because it was disabled or it got
|
|
|
|
|
+ // overwritten in some way) this will still be `false`. But if the row was added it will change to `true`.
|
|
|
|
|
+ isLastRow = currentRowIndex === table.childCount - 1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
let cellToFocus;
|
|
let cellToFocus;
|
|
|
|
|
|
|
|
// Move to first cell in next row.
|
|
// Move to first cell in next row.
|
|
|
if ( isForward && isLastCellInRow ) {
|
|
if ( isForward && isLastCellInRow ) {
|
|
|
|
|
+ if ( isLastRow ) {
|
|
|
|
|
+ // It's the last cell of a table - don't do anything (stay in current position).
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
const nextRow = table.getChild( currentRowIndex + 1 );
|
|
const nextRow = table.getChild( currentRowIndex + 1 );
|
|
|
|
|
|
|
|
cellToFocus = nextRow.getChild( 0 );
|
|
cellToFocus = nextRow.getChild( 0 );
|