Skip to content

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

:art: https://ld246.com/article/1715604432709

Vanessa5b17896a49d6
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts
index bd781c455d..1cacbfa30e 100644
--- a/app/src/menus/protyle.ts
+++ b/app/src/menus/protyle.ts
@@ -1086,9 +1086,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
openMenu(protyle.app, imgSrc, false, false);
}
- /// #if !BROWSER
window.siyuan.menus.menu.append(new MenuItem(exportAsset(imgElement.getAttribute("data-src"))).element);
- /// #endif
if (protyle?.app?.plugins) {
emitOpenMenu({
plugins: protyle.app.plugins,
@@ -1220,11 +1218,9 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
}
if (linkAddress) {
openMenu(protyle.app, linkAddress, false, true);
- /// #if !BROWSER
if (linkAddress?.startsWith("assets/")) {
window.siyuan.menus.menu.append(new MenuItem(exportAsset(linkAddress)).element);
}
- /// #endif
}
if (!protyle.disabled) {
if (linkAddress?.startsWith("assets/")) {
@@ -1583,9 +1579,7 @@ export const videoMenu = (protyle: IProtyle, nodeElement: Element, type: string)
submenu: openMenu(protyle.app, VideoSrc, true, false) as IMenu[]
});
}
- /// #if !BROWSER
subMenus.push(exportAsset(src));
- /// #endif
return subMenus;
};
diff --git a/app/src/menus/util.ts b/app/src/menus/util.ts
index 23990b604f..5f082caebe 100644
--- a/app/src/menus/util.ts
+++ b/app/src/menus/util.ts
@@ -9,15 +9,17 @@ import {Constants} from "../constants";
import {openNewWindowById} from "../window/openNewWindow";
import {MenuItem} from "./Menu";
import {App} from "../index";
-import {isInAndroid, updateHotkeyTip} from "../protyle/util/compatibility";
+import {isInAndroid, openByMobile, updateHotkeyTip} from "../protyle/util/compatibility";
import {checkFold} from "../util/noRelyPCFunction";
export const exportAsset = (src: string) => {
- /// #if !BROWSER
return {
label: window.siyuan.languages.export,
icon: "iconUpload",
async click() {
+ /// #if BROWSER
+ openByMobile(src);
+ /// #else
const result = await ipcRenderer.invoke(Constants.SIYUAN_GET, {
cmd: "showSaveDialog",
defaultPath: getAssetName(src) + pathPosix().extname(src),
@@ -26,9 +28,9 @@ export const exportAsset = (src: string) => {
if (!result.canceled) {
fetchPost("/api/file/copyFile", {src, dest: result.filePath});
}
+ /// #endif
}
};
- /// #endif
};
export const openEditorTab = (app: App, ids: string[], notebookId?: string, pathString?: string) => {
diff --git a/app/src/protyle/render/av/asset.ts b/app/src/protyle/render/av/asset.ts
index a80f7d732a..7be73da842 100644
--- a/app/src/protyle/render/av/asset.ts
+++ b/app/src/protyle/render/av/asset.ts
@@ -244,11 +244,9 @@ ${window.siyuan.languages.title}
}
});
openMenu(protyle ? protyle.app : window.siyuan.ws.app, linkAddress, false, true);
- /// #if !BROWSER
if (linkAddress?.startsWith("assets/")) {
window.siyuan.menus.menu.append(new MenuItem(exportAsset(linkAddress)).element);
}
- /// #endif
const rect = target.getBoundingClientRect();
menu.open({
x: rect.right,