Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2025-10-28 16:55:22 +08:00
commit 3afc7cefc4
10 changed files with 84 additions and 20 deletions

View file

@ -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()) {

View file

@ -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 = `<link rel="stylesheet" type="text/css" id="themeStyle" href="${servePath}appearance/themes/${themeName}/theme.css?${Constants.SIYUAN_VERSION}"/>`;