fix(editor): insertion position of new rows and columns is incorrect in table block (#10516)

fix: BS-2714
This commit is contained in:
zzj3720
2025-02-28 12:06:28 +00:00
parent 12acf7e4a0
commit 5c5c9f8dcd
3 changed files with 406 additions and 4 deletions

View File

@@ -180,14 +180,16 @@ export class TableCell extends SignalWatcher(
name: 'Insert Left',
prefix: InsertLeftIcon(),
select: () => {
this.dataManager.insertColumn(columnIndex - 1);
this.dataManager.insertColumn(
columnIndex > 0 ? columnIndex - 1 : undefined
);
},
}),
menu.action({
name: 'Insert Right',
prefix: InsertRightIcon(),
select: () => {
this.dataManager.insertColumn(columnIndex + 1);
this.dataManager.insertColumn(columnIndex);
},
}),
menu.action({
@@ -304,14 +306,16 @@ export class TableCell extends SignalWatcher(
name: 'Insert Above',
prefix: InsertAboveIcon(),
select: () => {
this.dataManager.insertRow(rowIndex - 1);
this.dataManager.insertRow(
rowIndex > 0 ? rowIndex - 1 : undefined
);
},
}),
menu.action({
name: 'Insert Below',
prefix: InsertBelowIcon(),
select: () => {
this.dataManager.insertRow(rowIndex + 1);
this.dataManager.insertRow(rowIndex);
},
}),
menu.action({