mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-02 23:08:49 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
7194e938d7
8 changed files with 47 additions and 7 deletions
|
|
@ -170,6 +170,7 @@
|
|||
"exportPDF3": "Page Scale",
|
||||
"exportPDF4": "Remove assets directory",
|
||||
"exportPDF5": "Keep folded",
|
||||
"exportPDF6": "Fusionar subdocumentos",
|
||||
"upload": "Upload",
|
||||
"reminderTip": "The reminder time cannot be less than the current time",
|
||||
"wechatTip": "The content block will be sent to the cloud in clear text, and pushed through the WeChat MP template message when it expires",
|
||||
|
|
|
|||
|
|
@ -674,6 +674,7 @@
|
|||
"export3": "Sólo texto de anclaje",
|
||||
"export4": "Notas a pie de página",
|
||||
"export5": "Ref. de anotación en PDF",
|
||||
"export6": "Fusionar subdocumentos",
|
||||
"export6": "Sobre el manejo del texto ancla en las anotaciones PDF al exportar",
|
||||
"export7": "Nombre de archivo - Número de página - Texto ancla",
|
||||
"export8": "Sólo texto ancla",
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@
|
|||
"exportPDF3": "Échelle de page",
|
||||
"exportPDF4": "Supprimer le répertoire des actifs",
|
||||
"exportPDF5": "Garder plié",
|
||||
"exportPDF6": "Fusionner les sous-documents",
|
||||
"upload": "Télécharger",
|
||||
"reminderTip": "The reminder time cannot be less than the current time",
|
||||
"wechatTip": "Le bloc de contenu sera envoyé au cloud en texte clair et transmis au message du modèle de compte officiel WeChat à son expiration.",
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@
|
|||
"exportPDF3": "頁面縮放",
|
||||
"exportPDF4": "移除 assets 目錄",
|
||||
"exportPDF5": "保持折疊狀態",
|
||||
"exportPDF6": "合併子文檔",
|
||||
"upload": "上傳",
|
||||
"reminderTip": "提醒時間不能小於當前時間",
|
||||
"wechatTip": "該內容塊將以明文形式發送到雲端,到期時通過微信公眾號模板消息進行推送",
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@
|
|||
"exportPDF3": "页面缩放",
|
||||
"exportPDF4": "移除 assets 目录",
|
||||
"exportPDF5": "保持折叠状态",
|
||||
"exportPDF6": "合并子文档",
|
||||
"upload": "上传",
|
||||
"reminderTip": "提醒时间不能小于当前时间",
|
||||
"wechatTip": "该内容块将以明文形式发送到云端,到期时通过微信公众号模板消息进行推送",
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
@ -70,6 +78,7 @@ const renderPDF = (id: string) => {
|
|||
pageSize: "A4",
|
||||
removeAssets: true,
|
||||
keepFold: false,
|
||||
mergeSubdocs: false,
|
||||
}));
|
||||
const servePath = window.location.protocol + "//" + window.location.host;
|
||||
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");
|
||||
|
|
@ -204,6 +213,13 @@ const renderPDF = (id: string) => {
|
|||
<span class="fn__hr"></span>
|
||||
<input id="keepFold" class="b3-switch" type="checkbox" ${localData.keepFold ? "checked" : ""}>
|
||||
</label>
|
||||
<label class="b3-label">
|
||||
<div>
|
||||
${window.siyuan.languages.exportPDF6}
|
||||
</div>
|
||||
<span class="fn__hr"></span>
|
||||
<input id="mergeSubdocs" class="b3-switch" type="checkbox" ${localData.mergeSubdocs ? "checked" : ""}>
|
||||
</label>
|
||||
<div class="fn__flex">
|
||||
<div class="fn__flex-1"></div>
|
||||
<button class="b3-button b3-button--cancel">${window.siyuan.languages.cancel}</button>
|
||||
|
|
@ -316,6 +332,7 @@ const renderPDF = (id: string) => {
|
|||
fetchPost("/api/export/exportPreviewHTML", {
|
||||
id: "${id}",
|
||||
keepFold: ${localData.keepFold},
|
||||
merge: ${localData.mergeSubdocs},
|
||||
}, response => {
|
||||
if (response.code === 1) {
|
||||
alert(response.msg)
|
||||
|
|
@ -359,10 +376,19 @@ const renderPDF = (id: string) => {
|
|||
const actionElement = document.getElementById('action');
|
||||
const keepFoldElement = actionElement.querySelector('#keepFold');
|
||||
keepFoldElement.addEventListener('change', () => {
|
||||
previewElement.innerHTML = '<div class="fn__loading" style="left:0"><img width="48px" src="${servePath}/stage/loading-pure.svg"></div>'
|
||||
refreshPreview();
|
||||
});
|
||||
const mergeSubdocsElement = actionElement.querySelector('#mergeSubdocs');
|
||||
mergeSubdocsElement.addEventListener('change', () => {
|
||||
refreshPreview();
|
||||
});
|
||||
|
||||
const refreshPreview = () => {
|
||||
previewElement.innerHTML = '<div class="fn__loading" style="left:0"><img width="48px" src="${servePath}/stage/loading-pure.svg"></div>'
|
||||
fetchPost("/api/export/exportPreviewHTML", {
|
||||
id: "${id}",
|
||||
keepFold: keepFoldElement.checked,
|
||||
merge: mergeSubdocsElement.checked,
|
||||
}, response2 => {
|
||||
if (response2.code === 1) {
|
||||
alert(response2.msg)
|
||||
|
|
@ -371,7 +397,8 @@ const renderPDF = (id: string) => {
|
|||
setPadding();
|
||||
renderPreview(response2.data.content);
|
||||
})
|
||||
})
|
||||
};
|
||||
|
||||
actionElement.querySelector("#scale").addEventListener("input", () => {
|
||||
actionElement.querySelector("#scaleTip").innerText = actionElement.querySelector("#scale").value;
|
||||
})
|
||||
|
|
@ -406,6 +433,7 @@ const renderPDF = (id: string) => {
|
|||
pageSize: actionElement.querySelector("#pageSize").value,
|
||||
},
|
||||
keepFold: keepFoldElement.checked,
|
||||
mergeSubdocs: mergeSubdocsElement.checked,
|
||||
removeAssets: actionElement.querySelector("#removeAssets").checked,
|
||||
rootId: "${id}",
|
||||
rootTitle: response.data.name,
|
||||
|
|
@ -453,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) => {
|
||||
|
|
@ -496,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") {
|
||||
|
|
|
|||
|
|
@ -374,7 +374,8 @@ const initWindow = () => {
|
|||
const msgId = showMessage(window.siyuan.languages.exporting, -1);
|
||||
localStorage.setItem(Constants.LOCAL_EXPORTPDF, JSON.stringify(Object.assign(ipcData.pdfOptions, {
|
||||
removeAssets: ipcData.removeAssets,
|
||||
keepFold: ipcData.keepFold
|
||||
keepFold: ipcData.keepFold,
|
||||
mergeSubdocs: ipcData.mergeSubdocs,
|
||||
})));
|
||||
try {
|
||||
window.siyuan.printWin.webContents.printToPDF(ipcData.pdfOptions).then((pdfData) => {
|
||||
|
|
|
|||
|
|
@ -79,6 +79,11 @@ func loadTreeNodes(box string, p string, level int) (ret []*ast.Node, err error)
|
|||
heading.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte(tree.Root.IALAttr("title"))})
|
||||
tree.Root.PrependChild(heading)
|
||||
for c := tree.Root.FirstChild; nil != c; c = c.Next {
|
||||
if ast.NodeParagraph == c.Type && nil == c.FirstChild {
|
||||
// 剔除空段落
|
||||
continue
|
||||
}
|
||||
|
||||
ret = append(ret, c)
|
||||
}
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue