Skip to content

Commit

Permalink
[WEB-] chore: trigger command k from input fields and editors (#4362)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaryan610 committed May 8, 2024
1 parent 13e6a67 commit cc4bb38
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions web/components/command-palette/command-palette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ export const CommandPalette: FC = observer(() => {

const keyPressed = key.toLowerCase();
const cmdClicked = ctrlKey || metaKey;

if (cmdClicked && keyPressed === "k" && !isAnyModalOpen) {
e.preventDefault();
toggleCommandPaletteModal(true);
}
// if on input, textarea or editor, don't do anything
if (
e.target instanceof HTMLTextAreaElement ||
Expand All @@ -209,10 +214,7 @@ export const CommandPalette: FC = observer(() => {
return;

if (cmdClicked) {
if (keyPressed === "k") {
e.preventDefault();
toggleCommandPaletteModal(true);
} else if (keyPressed === "c" && altKey) {
if (keyPressed === "c" && altKey) {
e.preventDefault();
copyIssueUrlToClipboard();
} else if (keyPressed === "b") {
Expand Down

0 comments on commit cc4bb38

Please sign in to comment.