From db60df3ff536894cfcd575e156a5564813958403 Mon Sep 17 00:00:00 2001 From: Bahaa Desoky <66293229+bahaa-desoky@users.noreply.github.com> Date: Wed, 30 Aug 2023 03:38:42 -0400 Subject: [PATCH] fix: deleting the last table row deletes the table fixes #53 --- src/plugins/table/TableNode.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/table/TableNode.tsx b/src/plugins/table/TableNode.tsx index 4bc0238f..43d351c5 100644 --- a/src/plugins/table/TableNode.tsx +++ b/src/plugins/table/TableNode.tsx @@ -137,7 +137,12 @@ export class TableNode extends DecoratorNode { } 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 {