🎨 delete row by keydown

This commit is contained in:
Vanessa 2023-12-15 12:42:34 +08:00
parent a104c94c5f
commit ff0973029d
3 changed files with 40 additions and 32 deletions

View file

@ -1,5 +1,5 @@
import {matchHotKey} from "../../util/hotKey";
import {selectRow} from "./row";
import {deleteRow, selectRow} from "./row";
import {cellScrollIntoView, popTextCell, updateCellsValue} from "./cell";
import {avContextmenu} from "./action";
import {hasClosestByClassName} from "../../util/hasClosest";
@ -132,6 +132,11 @@ export const avKeydown = (event: KeyboardEvent, nodeElement: HTMLElement, protyl
selectRow(selectRowElements[0].querySelector(".av__firstcol"), "unselectAll");
return true;
}
if (event.key === "Backspace") {
event.preventDefault();
deleteRow(nodeElement, protyle);
return true;
}
if (event.key === "Enter") {
selectRow(selectRowElements[0].querySelector(".av__firstcol"), "unselectAll");
popTextCell(protyle, [selectRowElements[0].querySelector(".av__cell")]);