fix: Row inserted incorrectly with merged first column cells (#11245)

closes #11241
This commit is contained in:
Tom Moor
2026-01-22 18:55:07 -05:00
committed by GitHub
parent 747a833a4d
commit d16bf03e47
+9 -1
View File
@@ -330,7 +330,15 @@ export default class TableRow extends Node {
decorations.push(buildAddRowDecoration(pos, index));
}
decorations.push(buildAddRowDecoration(pos, index + 1));
// Calculate the rowspan of the first column cell to determine the
// correct index for the "add row after" button. When cells are
// merged vertically, we need to insert after all merged rows.
const firstCellNode =
currentFirstCellPos !== undefined
? doc.nodeAt(currentFirstCellPos)
: null;
const rowspan = firstCellNode?.attrs.rowspan ?? 1;
decorations.push(buildAddRowDecoration(pos, index + rowspan));
}
});
}