Add shortcut description to right click + add Suppr shortcut + Fix next selection after deletion
This commit is contained in:
parent
4e3c5d71fd
commit
d580890b9d
6 changed files with 87 additions and 9 deletions
|
@ -105,7 +105,7 @@ export function DeleteContainer(
|
|||
/**
|
||||
* Returns the next container that will be selected
|
||||
* after the selectedContainer is removed.
|
||||
* If the selected container is removed, select the sibling before,
|
||||
* If the selected container is removed, select the sibling after,
|
||||
* If there is no sibling, select the parent,
|
||||
*
|
||||
* @param mainContainerClone Main container
|
||||
|
@ -121,7 +121,7 @@ function GetSelectedContainerOnDelete(
|
|||
index: number
|
||||
): string {
|
||||
const newSelectedContainer = FindContainerById(mainContainerClone, selectedContainerId) ??
|
||||
parent.children.at(index - 1) ??
|
||||
parent.children.at(index) ??
|
||||
parent;
|
||||
const newSelectedContainerId = newSelectedContainer.properties.id;
|
||||
return newSelectedContainerId;
|
||||
|
|
|
@ -6,7 +6,8 @@ export function OnKey(
|
|||
event: KeyboardEvent,
|
||||
history: IHistoryState[],
|
||||
historyCurrentStep: number,
|
||||
setHistoryCurrentStep: Dispatch<SetStateAction<number>>
|
||||
setHistoryCurrentStep: Dispatch<SetStateAction<number>>,
|
||||
deleteAction: () => void
|
||||
): void {
|
||||
if (!ENABLE_SHORTCUTS) {
|
||||
return;
|
||||
|
@ -24,5 +25,7 @@ export function OnKey(
|
|||
event.ctrlKey &&
|
||||
historyCurrentStep < history.length - 1) {
|
||||
setHistoryCurrentStep(historyCurrentStep + 1);
|
||||
} else if (event.key === 'Delete') {
|
||||
deleteAction();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue