-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Fix Ctrl+K shortcut conflict between command menu and link insertion #15163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,9 +45,18 @@ export const useCommandMenuHotKeys = () => { | |
|
|
||
| useGlobalHotkeys({ | ||
| keys: ['ctrl+k', 'meta+k'], | ||
| callback: () => { | ||
| closeKeyboardShortcutMenu(); | ||
| toggleCommandMenu(); | ||
| callback: (e: KeyboardEvent) => { | ||
| const active = document.activeElement; | ||
| const isInEditor = active?.closest('.editor'); | ||
| if (isInEditor !== null) { | ||
| return true; | ||
| } | ||
|
|
||
| if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === 'k') { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Redundant condition check - the keys array already defines 'ctrl+k' and 'meta+k', so this manual key check is unnecessary Prompt To Fix With AIThis is a comment left during a code review.
Path: packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHotKeys.ts
Line: 55:55
Comment:
**style:** Redundant condition check - the keys array already defines 'ctrl+k' and 'meta+k', so this manual key check is unnecessary
How can I resolve this? If you propose a fix, please make it concise. |
||
| e.preventDefault(); | ||
| closeKeyboardShortcutMenu(); | ||
| toggleCommandMenu(); | ||
| } | ||
|
Comment on lines
+49
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potential bug: The
|
||
| }, | ||
| containsModifier: true, | ||
| dependencies: [closeKeyboardShortcutMenu, toggleCommandMenu], | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider returning early with
returninstead ofreturn truefor consistency with other early returns in the codebasePrompt To Fix With AI