fix evt.ctrlKey and evt.shiftKey

pull/2019/head
amrbashir 8 months ago
parent 6d62ec79ec
commit ec35bf3625
No known key found for this signature in database
GPG Key ID: BBD7A47A2003FF33

@ -6,14 +6,7 @@ import { invoke } from '@tauri-apps/api/core'
// open <a href="..."> links with the API
window.addEventListener('click', function (evt) {
if (
evt.defaultPrevented ||
evt.button !== 0 ||
evt.metaKey ||
evt.altKey ||
evt.ctrlKey ||
evt.shiftKey
)
if (evt.defaultPrevented || evt.button !== 0 || evt.metaKey || evt.altKey)
return
const a = evt
@ -22,8 +15,13 @@ window.addEventListener('click', function (evt) {
| HTMLAnchorElement
| undefined
// only open if supposed to be open in a new tab
if (!a || !a.href || a.target !== '_blank') return
if (
!a ||
!a.href ||
// only open if supposed to be open in a new tab
!(a.target === '_blank' || evt.ctrlKey || evt.shiftKey)
)
return
const url = new URL(a.href)

@ -1 +1 @@
!function(){"use strict";"function"==typeof SuppressedError&&SuppressedError,window.addEventListener("click",(function(e){if(e.defaultPrevented||0!==e.button||e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)return;const t=e.composedPath().find((e=>e instanceof Node&&"A"===e.nodeName.toUpperCase()));if(!t||!t.href||"_blank"!==t.target)return;const n=new URL(t.href);n.origin===window.location.origin||["http:","https:","mailto:","tel:"].every((e=>n.protocol!==e))||(e.preventDefault(),async function(e,t={},n){window.__TAURI_INTERNALS__.invoke(e,t,n)}("plugin:opener|open_url",{path:n}))}))}();
!function(){"use strict";"function"==typeof SuppressedError&&SuppressedError,window.addEventListener("click",(function(e){if(e.defaultPrevented||0!==e.button||e.metaKey||e.altKey)return;const t=e.composedPath().find((e=>e instanceof Node&&"A"===e.nodeName.toUpperCase()));if(!t||!t.href||"_blank"!==t.target&&!e.ctrlKey&&!e.shiftKey)return;const n=new URL(t.href);n.origin===window.location.origin||["http:","https:","mailto:","tel:"].every((e=>n.protocol!==e))||(e.preventDefault(),async function(e,t={},n){window.__TAURI_INTERNALS__.invoke(e,t,n)}("plugin:opener|open_url",{path:n}))}))}();

Loading…
Cancel
Save