move click listener to app only for external links
This commit is contained in:
parent
0018fdaebc
commit
b58c9709e2
1 changed files with 12 additions and 14 deletions
26
ui/index.jsx
26
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
|
||||
|
|
Loading…
Reference in a new issue