소스 검색

fix: ctrl+clicking lyrics btn opening original url in background

Sv443 5 달 전
부모
커밋
0710959f79
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 2
      src/features/lyrics.ts

+ 3 - 2
src/features/lyrics.ts

@@ -326,7 +326,8 @@ export async function createLyricsBtn(geniusUrl?: string, hideIfLoading = true)
     const url = linkElem.href ?? geniusUrl;
     const url = linkElem.href ?? geniusUrl;
     if(!url || e instanceof MouseEvent)
     if(!url || e instanceof MouseEvent)
       return;
       return;
-    openInTab(url);
+    if(!e.ctrlKey && !e.altKey)
+      openInTab(url);
   }, {
   }, {
     preventDefault: false,
     preventDefault: false,
     stopPropagation: false,
     stopPropagation: false,
@@ -337,7 +338,7 @@ export async function createLyricsBtn(geniusUrl?: string, hideIfLoading = true)
   onInteraction(linkElem, async (e) => {
   onInteraction(linkElem, async (e) => {
     if(e.ctrlKey || e.altKey) {
     if(e.ctrlKey || e.altKey) {
       e.preventDefault();
       e.preventDefault();
-      e.stopPropagation();
+      e.stopImmediatePropagation();
 
 
       const search = await showPrompt({ type: "prompt", message: t("open_lyrics_search_prompt") });
       const search = await showPrompt({ type: "prompt", message: t("open_lyrics_search_prompt") });
       if(search && search.length > 0)
       if(search && search.length > 0)