Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Support copying file in the asset menu on Windows and macOS 2 (#17053)

Jeffrey Chen70a715ecd642
diff --git a/app/src/menus/util.ts b/app/src/menus/util.ts
index 0cb2d56877..1a8fed9df8 100644
--- a/app/src/menus/util.ts
+++ b/app/src/menus/util.ts
@@ -42,7 +42,7 @@ export const exportAsset = (src: string) => {
// 复制资源文件到系统剪贴板,在文件资源管理器中可粘贴为文件(仅 Windows、macOS 桌面端支持)
export const copyAsset = (src: string) => {
return {
- id: "copy",
+ id: "copyFile",
label: window.siyuan.languages.copyFile,
icon: "iconCopy",
click: () => {
diff --git a/app/src/protyle/render/av/asset.ts b/app/src/protyle/render/av/asset.ts
index cfe1442b5f..88b63d5bff 100644
--- a/app/src/protyle/render/av/asset.ts
+++ b/app/src/protyle/render/av/asset.ts
@@ -7,7 +7,7 @@ import {uploadFiles} from "../../upload";
import {pathPosix} from "../../../util/pathName";
import {openMenu} from "../../../menus/commonMenuItem";
import {MenuItem} from "../../../menus/Menu";
-import {copyPNGByLink, exportAsset} from "../../../menus/util";
+import {copyAsset, copyPNGByLink, exportAsset} from "../../../menus/util";
import {setPosition} from "../../../util/setPosition";
import {previewAttrViewImages} from "../../preview/image";
import {genAVValueHTML} from "./blockAttr";
@@ -367,6 +367,11 @@ export const editAssetItem = (options: {
}
if (linkAddress?.startsWith("assets/")) {
window.siyuan.menus.menu.append(new MenuItem(exportAsset(linkAddress)).element);
+ /// #if !BROWSER
+ if (["windows", "darwin"].includes(window.siyuan.config.system.os)) {
+ window.siyuan.menus.menu.append(new MenuItem(copyAsset(linkAddress)).element);
+ }
+ /// #endif
}
const rect = options.rect;
/// #if MOBILE