From 58f887baf1667e450e5b4b4ae7604485163f6fda Mon Sep 17 00:00:00 2001 From: Myriad-Dreamin Date: Sat, 23 Sep 2023 14:44:15 +0800 Subject: [PATCH] fix: git patch bug --- frontend/src/svg_utils.cjs | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/frontend/src/svg_utils.cjs b/frontend/src/svg_utils.cjs index 5d58e94..59d25b9 100644 --- a/frontend/src/svg_utils.cjs +++ b/frontend/src/svg_utils.cjs @@ -137,29 +137,12 @@ window.typstProcessSvg = function (docRoot) { } docRoot.addEventListener('click', event => { - const origin = event.target.closest(`a`); - - if (origin && origin.getAttribute('onclick') !== undefined) { - // stop the browser automatically opening a new tab - event.preventDefault(); - - // console.log(origin, origin.href); - - // do whatever you want with the url - if (typeof SVGAnimatedString !== 'undefined' && origin.href instanceof SVGAnimatedString) { - window.location = origin.href.baseVal; - } else { - window.location = origin.href; - } - return; - } - let elem = event.target; const origin = elem.closest(`a`); - if (origin && origin.getAttribute('onclick') === null) { - let target = origin.getAttribute('target'); - if (target === '_blank') { + // override target _blank + if (origin && !origin.getAttribute('onclick')) { + if (origin.getAttribute('target') === '_blank') { // remove the target attribute origin.removeAttribute('target'); }