Skip to content

Commit

Permalink
fix: deleting the last table row deletes the table
Browse files Browse the repository at this point in the history
fixes #53
  • Loading branch information
bahaa-desoky authored Aug 30, 2023
1 parent d0a04f7 commit db60df3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/plugins/table/TableNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,12 @@ export class TableNode extends DecoratorNode<JSX.Element> {
}

deleteRowAt(rowIndex: number): void {
this.getWritable().__mdastNode.children.splice(rowIndex, 1)
if (this.getRowCount() === 1) {
this.selectNext()
this.remove()
} else {
this.getWritable().__mdastNode.children.splice(rowIndex, 1)
}
}

addRowToBottom(): void {
Expand Down

0 comments on commit db60df3

Please sign in to comment.