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

closes #11241
This commit is contained in:
Tom Moor authored and GitHub committed 2026-01-22 23:55:07 +00:00
1 parent 747a833a4d
commit d16bf03e47
1 file changed
+9 -1
+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));
}
});
}