mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
✅ 尝试修复mac复制异常
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
<!-- todo 时间轴 -->
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="tp-video-box" v-if="videoData">
|
<div class="tp-video-box" v-if="videoData">
|
||||||
<!-- todo https://socialsisteryi.github.io/bilibili-API-collect/docs/video/videostream_url.html#%E8%A7%86%E9%A2%91%E4%BC%B4%E9%9F%B3%E9%9F%B3%E8%B4%A8%E4%BB%A3%E7%A0%81 -->
|
|
||||||
<iframe
|
<iframe
|
||||||
class="tp-video-container"
|
class="tp-video-container"
|
||||||
:src="props.data.insert.video"
|
:src="props.data.insert.video"
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
/**
|
/**
|
||||||
* @file utils/TGShare.ts
|
* @file utils/TGShare.ts
|
||||||
* @description 生成分享截图并保存到本地
|
* @description 生成分享截图并保存到本地
|
||||||
* @since Beta v0.6.7
|
* @since Beta v0.6.8
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import showSnackbar from "@comp/func/snackbar.js";
|
import showSnackbar from "@comp/func/snackbar.js";
|
||||||
import { path } from "@tauri-apps/api";
|
import { path } from "@tauri-apps/api";
|
||||||
import { save } from "@tauri-apps/plugin-dialog";
|
import { save } from "@tauri-apps/plugin-dialog";
|
||||||
import { writeFile } from "@tauri-apps/plugin-fs";
|
import { writeFile } from "@tauri-apps/plugin-fs";
|
||||||
|
import { platform } from "@tauri-apps/plugin-os";
|
||||||
import html2canvas from "html2canvas";
|
import html2canvas from "html2canvas";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
|
|
||||||
@@ -148,7 +149,7 @@ export async function generateShareImg(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 复制到剪贴板
|
* @description 复制到剪贴板
|
||||||
* @since Beta v0.6.2
|
* @since Beta v0.6.8
|
||||||
* @param {Uint8Array} buffer - 图片数据
|
* @param {Uint8Array} buffer - 图片数据
|
||||||
* @returns {Promise<void>} 无返回值
|
* @returns {Promise<void>} 无返回值
|
||||||
*/
|
*/
|
||||||
@@ -156,6 +157,14 @@ export async function copyToClipboard(buffer: Uint8Array): Promise<void> {
|
|||||||
const blob = new Blob([buffer], { type: "image/png" });
|
const blob = new Blob([buffer], { type: "image/png" });
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
// todo mac 会报错: https://bugs.webkit.org/show_bug.cgi?id=222262
|
// todo mac 会报错: https://bugs.webkit.org/show_bug.cgi?id=222262
|
||||||
|
if (platform() === "macos") {
|
||||||
|
// todo 待测试
|
||||||
|
navigator.clipboard.write([new ClipboardItem({ [blob.type]: blob })]).then(
|
||||||
|
() => URL.revokeObjectURL(url),
|
||||||
|
(err) => TGLogger.Error(`[copyToClipboard] 复制到剪贴板失败: ${err}`),
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
await navigator.clipboard.write([new ClipboardItem({ [blob.type]: blob })]);
|
await navigator.clipboard.write([new ClipboardItem({ [blob.type]: blob })]);
|
||||||
URL.revokeObjectURL(url);
|
URL.revokeObjectURL(url);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user