-
Notifications
You must be signed in to change notification settings - Fork 18
I/6406: Fix logic behind removing multiple columns or rows in a row #286
Conversation
I'm not going to lie to you – this is not something I want to verify by analysing the implementation 🤣I've briefly scanned the code but that's it. cc @ckeditor/qa-team, could you go through the various cases that were failing recently and perhaps some more? |
Sure - the change was minimal actually - regenerate |
If this happens for one row selection then it looks like a bug in the original remove row algorithm. So if nothing similar happens I'm confident that this change is OK. I'd move the above case as a general table issue because it looks like an edge case as those spans are tough. BTW, thanks for coloured samples - it is so easy to spot what's happening in the case :) |
We've tested it and changes look good 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed refreshing the table map for each iteration was what we needed 👍 works much better now, LGTM.
There was one detail with the variable name which I'll push in a second and merge.
src/commands/removerowcommand.js
Outdated
const rowIndexes = tableMap.filter( entry => selectedCells.includes( entry.cell ) ).map( el => el.row ); | ||
const minRowIndex = rowIndexes[ 0 ]; | ||
const maxRowIndex = rowIndexes[ rowIndexes.length - 1 ]; | ||
const removedRowIndexes = getRowIndexes( selectedCells ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These cells are not yet removed, these are selected cells that are about to be removed.
Suggested merge commit message (convention)
Fix: Recalculate table geometry on each row or column removal. Closes ckeditor/ckeditor5#6406.
Additional information
I've noticed that the
tableMap
was passed but it is static. You must get the table map after each row/column removal for loop operations otherwise the remove row/column algorithm would work on obsolete data.