From b58c9709e218743c8df4d2d0784aeaae79317253 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Fri, 14 Aug 2020 17:18:32 -0400 Subject: [PATCH] move click listener to app only for external links --- ui/index.jsx | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/ui/index.jsx b/ui/index.jsx index 460dedaa8..daee85527 100644 --- a/ui/index.jsx +++ b/ui/index.jsx @@ -217,6 +217,18 @@ remote.getCurrentWindow().on('leave-full-screen', event => { document.webkitExitFullscreen(); }); +document.addEventListener('click', event => { + let { target } = event; + + while (target && target !== document) { + if (target.matches('a[href^="http"]') || target.matches('a[href^="mailto"]')) { + event.preventDefault(); + shell.openExternal(target.href); + return; + } + target = target.parentNode; + } +}); // @endif document.addEventListener('dragover', event => { @@ -225,20 +237,6 @@ document.addEventListener('dragover', event => { document.addEventListener('drop', event => { event.preventDefault(); }); -document.addEventListener('click', event => { - let { target } = event; - - while (target && target !== document) { - if (target.matches('a[href^="http"]') || target.matches('a[href^="mailto"]')) { - // @if TARGET='app' - event.preventDefault(); - shell.openExternal(target.href); - return; - // @endif - } - target = target.parentNode; - } -}); function AppWrapper() { // Splash screen and sdk setup not needed on web