Skip to content

Commit

Permalink
Add event to keyboard action
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaitanLyss committed Jul 12, 2024
1 parent 2751307 commit 08187bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@selenite/commons",
"version": "0.0.5",
"version": "0.0.6",
"scripts": {
"dev": "vite dev",
"build": "vite build && npm run package",
Expand Down
6 changes: 3 additions & 3 deletions src/lib/actions/shortcut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ type KeyboardShortcut = {
shift?: boolean;
};
type ShortcutSettings = {
shortcuts: KeyboardShortcut[] | ((shortcut: KeyboardEvent) => boolean) | KeyboardShortcut;
action?: () => unknown;
shortcuts: KeyboardShortcut[] | ((e: KeyboardEvent) => boolean) | KeyboardShortcut;
action?: (e: KeyboardEvent) => unknown;
ignoreElements?: string[];
};
function makeShortcutListener(params: ShortcutSettings): (e: KeyboardEvent) => void {
Expand Down Expand Up @@ -47,7 +47,7 @@ function makeShortcutListener(params: ShortcutSettings): (e: KeyboardEvent) => v
e.preventDefault();

console.log(`shortcut: ${shortcutToString(triggeredShortcut)}`);
if (action) action();
if (action) action(e);
};
}

Expand Down

0 comments on commit 08187bd

Please sign in to comment.