mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 01:50:12 +01:00
This commit is contained in:
parent
a115273ccf
commit
c8b9eb9b6b
2 changed files with 8 additions and 4 deletions
|
|
@ -5,7 +5,7 @@ import {confirmDialog} from "../dialog/confirmDialog";
|
|||
import {getSearch, isMobile, isValidAttrName} from "../util/functions";
|
||||
import {isLocalPath, movePathTo, moveToPath, pathPosix} from "../util/pathName";
|
||||
import {MenuItem} from "./Menu";
|
||||
import {saveExport} from "../protyle/export";
|
||||
import {onExport, saveExport} from "../protyle/export";
|
||||
import {isInAndroid, isInHarmony, openByMobile, writeText} from "../protyle/util/compatibility";
|
||||
import {fetchPost, fetchSyncPost} from "../util/fetch";
|
||||
import {hideMessage, showMessage} from "../dialog/message";
|
||||
|
|
@ -765,8 +765,9 @@ export const exportMd = (id: string) => {
|
|||
id,
|
||||
keepFold: localData.keepFold,
|
||||
merge: localData.mergeSubdocs,
|
||||
}, response => {
|
||||
window.JSAndroid.exportPDF(response.data.content);
|
||||
}, async response => {
|
||||
const html = await onExport(response, undefined, {type: "pdf", id});
|
||||
window.JSAndroid.exportPDF(html);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -635,7 +635,7 @@ const getExportPath = (option: IExportOptions, removeAssets?: boolean, mergeSubd
|
|||
});
|
||||
};
|
||||
|
||||
const onExport = async (data: IWebSocketData, filePath: string, exportOption: IExportOptions, removeAssets?: boolean, msgId?: string) => {
|
||||
export const onExport = async (data: IWebSocketData, filePath: string, exportOption: IExportOptions, removeAssets?: boolean, msgId?: string) => {
|
||||
let themeName = window.siyuan.config.appearance.themeLight;
|
||||
let mode = 0;
|
||||
if (["html", "htmlmd"].includes(exportOption.type) && window.siyuan.config.appearance.mode === 1) {
|
||||
|
|
@ -711,6 +711,9 @@ id="preview">${data.data.content}</div>
|
|||
})
|
||||
});
|
||||
</script></body></html>`;
|
||||
if (typeof filePath === "undefined") {
|
||||
return html;
|
||||
}
|
||||
const htmlPath = path.join(filePath, "index.html");
|
||||
fs.writeFileSync(htmlPath, html);
|
||||
afterExport(htmlPath, msgId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue