move click listener to app only for external links

This commit is contained in:
Sean Yesmunt 2020-08-14 17:18:32 -04:00
parent 0018fdaebc
commit b58c9709e2

View file

@ -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