diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts index bd781c455..1cacbfa30 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 23990b604..5f082caeb 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 a80f7d732..7be73da84 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,