mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 16:10:12 +01:00
This commit is contained in:
parent
17d7b69c01
commit
5c79a0c387
2 changed files with 11 additions and 3 deletions
|
|
@ -766,8 +766,16 @@ export const exportMd = (id: string) => {
|
||||||
keepFold: localData.keepFold,
|
keepFold: localData.keepFold,
|
||||||
merge: localData.mergeSubdocs,
|
merge: localData.mergeSubdocs,
|
||||||
}, async response => {
|
}, async response => {
|
||||||
|
const htmlElement = document.createElement("template");
|
||||||
|
htmlElement.innerHTML = response.data.content;
|
||||||
|
htmlElement.content.querySelectorAll("svg > use").forEach(item => {
|
||||||
|
const symbolElement = document.querySelector(`symbol${item.getAttribute("xlink:href")}`);
|
||||||
|
item.parentElement.setAttribute("viewBox", symbolElement.getAttribute("viewBox"));
|
||||||
|
item.outerHTML = symbolElement.innerHTML;
|
||||||
|
});
|
||||||
|
response.data.content = htmlElement.innerHTML
|
||||||
const html = await onExport(response, undefined, {type: "pdf", id});
|
const html = await onExport(response, undefined, {type: "pdf", id});
|
||||||
window.JSAndroid.exportPDF(html.replace('<use xlink:href="#iconDot"></use>', '<path d="M5.501 9.999c0 2.485 2.016 4.499 4.501 4.499s4.497-2.016 4.497-4.499c0-2.485-2.012-4.497-4.497-4.497s-4.501 2.012-4.501 4.497z"></path>'));
|
window.JSAndroid.exportPDF(html);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -651,6 +651,7 @@ export const onExport = async (data: IWebSocketData, filePath: string, exportOpt
|
||||||
const html = `<!DOCTYPE html>
|
const html = `<!DOCTYPE html>
|
||||||
<html lang="${window.siyuan.config.appearance.lang}" data-theme-mode="${getThemeMode()}" data-light-theme="${window.siyuan.config.appearance.themeLight}" data-dark-theme="${window.siyuan.config.appearance.themeDark}">
|
<html lang="${window.siyuan.config.appearance.lang}" data-theme-mode="${getThemeMode()}" data-light-theme="${window.siyuan.config.appearance.themeLight}" data-dark-theme="${window.siyuan.config.appearance.themeDark}">
|
||||||
<head>
|
<head>
|
||||||
|
<base href="${window.location.protocol}//${window.location.host}">
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
|
||||||
|
|
@ -671,8 +672,7 @@ export const onExport = async (data: IWebSocketData, filePath: string, exportOpt
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="${["htmlmd", "word"].includes(exportOption.type) ? "b3-typography" : "protyle-wysiwyg" + (window.siyuan.config.editor.displayBookmarkIcon ? " protyle-wysiwyg--attr" : "")}"
|
<div class="${["htmlmd", "word"].includes(exportOption.type) ? "b3-typography" : "protyle-wysiwyg" + (window.siyuan.config.editor.displayBookmarkIcon ? " protyle-wysiwyg--attr" : "")}"
|
||||||
style="max-width: 800px;margin: 0 auto;"
|
style="max-width: 800px;margin: 0 auto;" id="preview">${data.data.content}</div>
|
||||||
id="preview">${data.data.content}</div>
|
|
||||||
<script src="appearance/icons/${window.siyuan.config.appearance.icon}/icon.js?v=${Constants.SIYUAN_VERSION}"></script>
|
<script src="appearance/icons/${window.siyuan.config.appearance.icon}/icon.js?v=${Constants.SIYUAN_VERSION}"></script>
|
||||||
<script src="stage/build/export/protyle-method.js?v=${Constants.SIYUAN_VERSION}"></script>
|
<script src="stage/build/export/protyle-method.js?v=${Constants.SIYUAN_VERSION}"></script>
|
||||||
<script src="stage/protyle/js/lute/lute.min.js?v=${Constants.SIYUAN_VERSION}"></script>
|
<script src="stage/protyle/js/lute/lute.min.js?v=${Constants.SIYUAN_VERSION}"></script>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue