🎨 支持合并子文档导出 Word/PDF https://github.com/siyuan-note/siyuan/issues/3219

This commit is contained in:
Liang Ding 2022-12-11 10:22:13 +08:00
parent db131e7f1a
commit ef35d48a7b
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -37,6 +37,13 @@ export const saveExport = (option: { type: string, id: string }) => {
<span class="fn__space"></span>
<input id="removeAssets" class="b3-switch" type="checkbox" ${localData === "true" ? "checked" : ""}>
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.exportPDF6}
</div>
<span class="fn__space"></span>
<input id="mergeSubdocs" class="b3-switch" type="checkbox" ${localData === "true" ? "checked" : ""}>
</label>
</div>
<div class="b3-dialog__action">
<button class="b3-button b3-button--cancel">${window.siyuan.languages.cancel}</button><div class="fn__space"></div>
@ -50,8 +57,9 @@ export const saveExport = (option: { type: string, id: string }) => {
});
btnsElement[1].addEventListener("click", () => {
const removeAssets = (wordDialog.element.querySelector("#removeAssets") as HTMLInputElement).checked;
localStorage.setItem(Constants.LOCAL_EXPORTWORD, removeAssets.toString());
getExportPath(option, removeAssets);
const mergeSubdocs = (wordDialog.element.querySelector("#mergeSubdocs") as HTMLInputElement).checked;
localStorage.setItem(Constants.LOCAL_EXPORTWORD, JSON.stringify({removeAssets, mergeSubdocs}));
getExportPath(option, removeAssets, mergeSubdocs);
wordDialog.destroy();
});
} else {
@ -473,7 +481,7 @@ export const destroyPrintWindow = () => {
window.siyuan.printWin.destroy();
};
const getExportPath = (option: { type: string, id: string }, removeAssets?: boolean) => {
const getExportPath = (option: { type: string, id: string }, removeAssets?: boolean, mergeSubdocs?: boolean) => {
fetchPost("/api/block/getBlockInfo", {
id: option.id
}, (response) => {
@ -516,7 +524,8 @@ const getExportPath = (option: { type: string, id: string }, removeAssets?: bool
fetchPost(url, {
id: option.id,
pdf: option.type === "pdf",
removeAssets,
removeAssets: removeAssets,
merge: mergeSubdocs,
savePath
}, exportResponse => {
if (option.type === "word") {