mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
This commit is contained in:
parent
dfdc089f3e
commit
0361599aba
1 changed files with 16 additions and 3 deletions
|
|
@ -117,13 +117,23 @@ export const saveExport = (option: IExportOptions) => {
|
||||||
const getSnippetCSS = () => {
|
const getSnippetCSS = () => {
|
||||||
let snippetCSS = "";
|
let snippetCSS = "";
|
||||||
document.querySelectorAll("style").forEach((item) => {
|
document.querySelectorAll("style").forEach((item) => {
|
||||||
if (item.id.startsWith("snippet")) {
|
if (item.id.startsWith("snippetCSS")) {
|
||||||
snippetCSS += item.outerHTML;
|
snippetCSS += item.outerHTML;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return snippetCSS;
|
return snippetCSS;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getSnippetJS = () => {
|
||||||
|
let snippetScript = "";
|
||||||
|
document.querySelectorAll("script").forEach((item) => {
|
||||||
|
if (item.id.startsWith("snippetJS")) {
|
||||||
|
snippetScript += item.outerHTML;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return snippetScript;
|
||||||
|
};
|
||||||
|
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
const renderPDF = async (id: string) => {
|
const renderPDF = async (id: string) => {
|
||||||
const localData = window.siyuan.storage[Constants.LOCAL_EXPORTPDF];
|
const localData = window.siyuan.storage[Constants.LOCAL_EXPORTPDF];
|
||||||
|
|
@ -624,7 +634,9 @@ ${getIconScript(servePath)}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
</script></body></html>`;
|
</script>
|
||||||
|
${getSnippetJS()}
|
||||||
|
</body></html>`;
|
||||||
fetchPost("/api/export/exportTempContent", {content: html}, (response) => {
|
fetchPost("/api/export/exportTempContent", {content: html}, (response) => {
|
||||||
ipcRenderer.send(Constants.SIYUAN_EXPORT_NEWWINDOW, response.data.url);
|
ipcRenderer.send(Constants.SIYUAN_EXPORT_NEWWINDOW, response.data.url);
|
||||||
});
|
});
|
||||||
|
|
@ -776,7 +788,8 @@ ${getIconScript(servePath)}
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
</script></body></html>`;
|
</script>
|
||||||
|
${getSnippetJS()}</body></html>`;
|
||||||
// 移动端导出 pdf、浏览器导出 HTML
|
// 移动端导出 pdf、浏览器导出 HTML
|
||||||
if (typeof filePath === "undefined") {
|
if (typeof filePath === "undefined") {
|
||||||
return html;
|
return html;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue