fix: 增加针对动态创建 a 标签跳转其他页面重定向下载的处理
This commit is contained in:
10
src-tauri/src/inject/event.js
vendored
10
src-tauri/src/inject/event.js
vendored
@@ -134,7 +134,7 @@ function detectDownloadByCreateAnchor() {
|
|||||||
const anchorEle = createEle.call(document, el);
|
const anchorEle = createEle.call(document, el);
|
||||||
|
|
||||||
// use addEventListener to avoid overriding the original click event.
|
// use addEventListener to avoid overriding the original click event.
|
||||||
anchorEle.addEventListener('click', () => {
|
anchorEle.addEventListener('click', (e) => {
|
||||||
const url = anchorEle.href;
|
const url = anchorEle.href;
|
||||||
const filename = anchorEle.download || getFilenameFromUrl(url);
|
const filename = anchorEle.download || getFilenameFromUrl(url);
|
||||||
if (window.blobToUrlCaches.has(url)) {
|
if (window.blobToUrlCaches.has(url)) {
|
||||||
@@ -142,6 +142,8 @@ function detectDownloadByCreateAnchor() {
|
|||||||
// case: downoload from dataURL -> convert dataURL ->
|
// case: downoload from dataURL -> convert dataURL ->
|
||||||
} else if (url.startsWith('data:')) {
|
} else if (url.startsWith('data:')) {
|
||||||
downladFromDataUri(url, filename);
|
downladFromDataUri(url, filename);
|
||||||
|
} else {
|
||||||
|
handleExternalLink(e, url);
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
@@ -150,12 +152,6 @@ function detectDownloadByCreateAnchor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
domEl.addEventListener('mousedown', (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
if (e.buttons === 1 && e.detail !== 2) {
|
|
||||||
appWindow.startDragging().then();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
domEl.addEventListener('touchstart', () => {
|
domEl.addEventListener('touchstart', () => {
|
||||||
appWindow.startDragging().then();
|
appWindow.startDragging().then();
|
||||||
|
|||||||
Reference in New Issue
Block a user