mirror of
https://github.com/baptisteArno/typebot.io.git
synced 2026-06-19 21:04:33 +08:00
🚸 Add select all keyboard shortcut for groups
This commit is contained in:
parent
30a045ef2a
commit
51fbb26777
@ -127,6 +127,9 @@ export const GroupSelectionMenu = ({
|
||||
},
|
||||
backspace: handleDelete,
|
||||
paste: handlePaste,
|
||||
selectAll: () => {
|
||||
setFocusedGroups(typebot?.groups.map((g) => g.id) ?? []);
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
|
||||
@ -12,6 +12,7 @@ type Props = {
|
||||
cut?: () => void;
|
||||
duplicate?: () => void;
|
||||
backspace?: () => void;
|
||||
selectAll?: () => void;
|
||||
};
|
||||
|
||||
export const useKeyboardShortcuts = ({
|
||||
@ -22,6 +23,7 @@ export const useKeyboardShortcuts = ({
|
||||
cut,
|
||||
duplicate,
|
||||
backspace,
|
||||
selectAll,
|
||||
}: Props) => {
|
||||
const isUndoShortcut = (event: KeyboardEvent) =>
|
||||
(event.metaKey || event.ctrlKey) && event.key === "z" && !event.shiftKey;
|
||||
@ -41,6 +43,9 @@ export const useKeyboardShortcuts = ({
|
||||
const isDuplicateShortcut = (event: KeyboardEvent) =>
|
||||
(event.metaKey || event.ctrlKey) && event.key === "d";
|
||||
|
||||
const isSelectAllShortcut = (event: KeyboardEvent) =>
|
||||
(event.metaKey || event.ctrlKey) && event.key === "a";
|
||||
|
||||
const isBackspaceShortcut = (event: KeyboardEvent) =>
|
||||
event.key === "Backspace";
|
||||
|
||||
@ -95,5 +100,10 @@ export const useKeyboardShortcuts = ({
|
||||
backspace();
|
||||
return;
|
||||
}
|
||||
if (selectAll && isSelectAllShortcut(event)) {
|
||||
event.preventDefault();
|
||||
selectAll();
|
||||
return;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user