mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
♻️ 对于部分点击外部事件进行特殊处理
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file utils/TGShare.ts
|
||||
* @description 生成分享截图并保存到本地
|
||||
* @since Beta v0.3.8
|
||||
* @since Beta v0.3.9
|
||||
*/
|
||||
|
||||
import { dialog, fs, http, path } from "@tauri-apps/api";
|
||||
@@ -72,7 +72,7 @@ function getShareImgBgColor(): string {
|
||||
|
||||
/**
|
||||
* @description 生成分享截图
|
||||
* @since Beta v0.3.8
|
||||
* @since Beta v0.3.9
|
||||
* @param {string} fileName - 文件名
|
||||
* @param {HTMLElement} element - 元素
|
||||
* @param {number} scale - 缩放比例
|
||||
@@ -122,15 +122,14 @@ export async function generateShareImg(
|
||||
title: "图像过大",
|
||||
text: `图像大小为 ${sizeStr},是否保存到文件?`,
|
||||
});
|
||||
if (!saveFile) {
|
||||
showSnackbar({
|
||||
color: "warn",
|
||||
text: "将尝试保存到剪贴板",
|
||||
});
|
||||
} else {
|
||||
if (saveFile === true) {
|
||||
await saveCanvasImg(buffer, fileName);
|
||||
return;
|
||||
}
|
||||
showSnackbar({
|
||||
color: "warn",
|
||||
text: "将尝试保存到剪贴板",
|
||||
});
|
||||
}
|
||||
try {
|
||||
await copyToClipboard(buffer);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import TGClient from "./TGClient";
|
||||
import { createPost } from "./TGWindow";
|
||||
import showConfirm from "../components/func/confirm";
|
||||
import showSnackbar from "../components/func/snackbar";
|
||||
|
||||
/**
|
||||
* @function parsePost
|
||||
@@ -115,16 +116,20 @@ export async function parseLink(
|
||||
title: "采用内置 JSBridge?",
|
||||
text: "取消则使用外部浏览器打开",
|
||||
});
|
||||
if (openCheck === undefined) {
|
||||
showSnackbar({
|
||||
text: "已取消打开",
|
||||
color: "warn",
|
||||
});
|
||||
return true;
|
||||
}
|
||||
if (!openCheck) return url.href;
|
||||
const typeCheck = await showConfirm({
|
||||
title: "采用宽屏模式?",
|
||||
text: "取消则使用默认竖屏",
|
||||
});
|
||||
if (typeCheck) {
|
||||
await TGClient.open("web_act", link);
|
||||
} else {
|
||||
await TGClient.open("web_act_thin", link);
|
||||
}
|
||||
if (!typeCheck) await TGClient.open("web_act_thin", link);
|
||||
else await TGClient.open("web_act", link);
|
||||
return true;
|
||||
}
|
||||
return url.href.toString();
|
||||
|
||||
Reference in New Issue
Block a user