Skip to content

Commit

Permalink
[24.1] Ctrl-click on SwitchHistoryLink opens in new tab
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedhamidawan committed Oct 4, 2024
1 parent f670f0f commit 64e97bd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions client/src/components/History/SwitchToHistoryLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useRouter } from "vue-router/composables";
import { type HistorySummary, userOwnsHistory } from "@/api";
import { Toast } from "@/composables/toast";
import { useEventStore } from "@/stores/eventStore";
import { useHistoryStore } from "@/stores/historyStore";
import { useUserStore } from "@/stores/userStore";
import { errorMessageAsString } from "@/utils/simple-error";
Expand Down Expand Up @@ -47,8 +48,10 @@ const actionText = computed(() => {
return "View in new tab";
});
async function onClick(history: HistorySummary) {
if (canSwitch.value) {
async function onClick(event: MouseEvent, history: HistorySummary) {
const eventStore = useEventStore();
const ctrlKey = eventStore.isMac ? event.metaKey : event.ctrlKey;
if (!ctrlKey && canSwitch.value) {
if (props.filters) {
historyStore.applyFilters(history.id, props.filters);
} else {
Expand Down Expand Up @@ -78,7 +81,7 @@ function viewHistoryInNewTab(history: HistorySummary) {
class="truncate"
href="#"
:title="`<b>${actionText}</b><br>${history.name}`"
@click.stop="onClick(history)">
@click.stop="onClick($event, history)">
{{ history.name }}
</BLink>

Expand Down

0 comments on commit 64e97bd

Please sign in to comment.