diff --git a/app/src/menus/commonMenuItem.ts b/app/src/menus/commonMenuItem.ts index 3263c5498..04671a826 100644 --- a/app/src/menus/commonMenuItem.ts +++ b/app/src/menus/commonMenuItem.ts @@ -767,7 +767,8 @@ export const exportMd = (id: string) => { keepFold: localData.keepFold, merge: localData.mergeSubdocs, }, async response => { - const html = await onExport(response, undefined, {type: "pdf", id}); + const servePath = window.location.protocol + "//" + window.location.host + "/"; + const html = await onExport(response, undefined, servePath, {type: "pdf", id}); if (isInAndroid()) { window.JSAndroid.print(html); } else if (isInHarmony()) { diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.ts index 26edcda10..306a71cdf 100644 --- a/app/src/protyle/export/index.ts +++ b/app/src/protyle/export/index.ts @@ -43,7 +43,7 @@ export const saveExport = (option: IExportOptions) => { merge: true, savePath: "" }, async exportResponse => { - const html = await onExport(exportResponse, undefined, option); + const html = await onExport(exportResponse, undefined, "", option); fetchPost("/api/export/exportBrowserHTML", { folder: exportResponse.data.folder, html: html, @@ -684,7 +684,7 @@ const getExportPath = (option: IExportOptions, removeAssets?: boolean, mergeSubd } afterExport(exportResponse.data.path, msgId); } else { - onExport(exportResponse, savePath, option, msgId); + onExport(exportResponse, savePath, "", option, msgId); } }); } @@ -692,7 +692,7 @@ const getExportPath = (option: IExportOptions, removeAssets?: boolean, mergeSubd }; /// #endif -export const onExport = async (data: IWebSocketData, filePath: string, exportOption: IExportOptions, msgId?: string) => { +export const onExport = async (data: IWebSocketData, filePath: string, servePath: string, exportOption: IExportOptions, msgId?: string) => { let themeName = window.siyuan.config.appearance.themeLight; let mode = 0; if (["html", "htmlmd"].includes(exportOption.type) && window.siyuan.config.appearance.mode === 1) { @@ -700,8 +700,6 @@ export const onExport = async (data: IWebSocketData, filePath: string, exportOpt mode = 1; } const isDefault = (window.siyuan.config.appearance.mode === 1 && window.siyuan.config.appearance.themeDark === "midnight") || (window.siyuan.config.appearance.mode === 0 && window.siyuan.config.appearance.themeLight === "daylight"); - const isLocalExport = typeof filePath !== "undefined"; - const servePath = isLocalExport ? "" : window.location.protocol + "//" + window.location.host + "/"; let themeStyle = ""; if (!isDefault) { themeStyle = ``;