Skip to content

Commit

Permalink
command/ctrl click for "New" action in top nav
Browse files Browse the repository at this point in the history
  • Loading branch information
kyracho committed Dec 5, 2024
1 parent cb7e5f6 commit b8d3f48
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export const getNewSearchAppMenuItem = ({
}: {
onNewSearch: () => void;
}): AppMenuActionPrimary => {
let isModifierKeyPressed = false;
document.addEventListener('mousedown', (event: MouseEvent) => {
isModifierKeyPressed = event.metaKey || event.ctrlKey;
});
return {
id: AppMenuActionId.new,
type: AppMenuActionType.primary,
Expand All @@ -28,7 +32,13 @@ export const getNewSearchAppMenuItem = ({
iconType: 'plus',
testId: 'discoverNewButton',
onClick: () => {
onNewSearch();
const newDiscoverUrl = `${window.location.origin}/app/discover`;
if (isModifierKeyPressed) {
window.open(newDiscoverUrl, '_blank');
} else {
onNewSearch();
}
isModifierKeyPressed = false;
},
},
};
Expand Down

0 comments on commit b8d3f48

Please sign in to comment.