Skip to content
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

[WEB-] chore: trigger command k from input fields and editors #4362

Merged
merged 1 commit into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this toggleCommand take an input?

}
// 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
Loading