Vanessa 2023-10-25 22:59:50 +08:00
parent 91ef77d387
commit e50f23ba02
4 changed files with 16 additions and 16 deletions

View file

@ -11,10 +11,6 @@
@import "component/slider";
@import "component/text-field";
.protyle-wysiwyg {
font-family: var(--b3-font-family);
}
.protyle-wysiwyg a,
.b3-typography a {
color: var(--b3-protyle-inline-link-color);

View file

@ -1,5 +1,4 @@
.protyle {
font-family: var(--b3-font-family);
overflow-x: hidden;
background-color: var(--b3-theme-background);
position: relative;

View file

@ -68,6 +68,16 @@ export const saveExport = (option: IExportOptions) => {
/// #endif
};
const getSnippetCSS = () => {
let snippetCSS = "";
document.querySelectorAll("style").forEach((item) => {
if (item.id.startsWith("snippet")) {
snippetCSS += item.innerHTML;
}
});
return snippetCSS;
};
/// #if !BROWSER
const renderPDF = (id: string) => {
const localData = window.siyuan.storage[Constants.LOCAL_EXPORTPDF];
@ -78,12 +88,6 @@ const renderPDF = (id: string) => {
themeStyle = `<link rel="stylesheet" type="text/css" id="themeStyle" href="${servePath}/appearance/themes/${window.siyuan.config.appearance.themeLight}/theme.css?${Constants.SIYUAN_VERSION}"/>`;
}
// data-theme-mode="light" https://github.com/siyuan-note/siyuan/issues/7379
let snippetCSS = "";
document.querySelectorAll("style").forEach((item) => {
if (item.id.startsWith("snippet")) {
snippetCSS += item.innerHTML;
}
});
const html = `<!DOCTYPE html>
<html lang="${window.siyuan.config.appearance.lang}" data-theme-mode="light" data-light-theme="${window.siyuan.config.appearance.themeLight}" data-dark-theme="${window.siyuan.config.appearance.themeDark}">
<head>
@ -101,6 +105,7 @@ const renderPDF = (id: string) => {
<style>
body {
margin: 0;
font-family: var(--b3-font-family);
}
#action {
@ -152,10 +157,8 @@ const renderPDF = (id: string) => {
margin-bottom: 12px;
}
${setInlineStyle(false)}
</style>
<style>
${document.getElementById("pluginsStyle").innerHTML}
${snippetCSS}
${getSnippetCSS()}
</style>
</head>
<body>
@ -617,8 +620,10 @@ const onExport = (data: IWebSocketData, filePath: string, exportOption: IExportO
${themeStyle}
<title>${pathPosix().basename(filePath)} - ${window.siyuan.languages.siyuanNote} v${Constants.SIYUAN_VERSION}</title>
<style>
body {background-color: var(--b3-theme-background);color: var(--b3-theme-on-background)}
body {font-family: var(--b3-font-family);background-color: var(--b3-theme-background);color: var(--b3-theme-on-background)}
${setInlineStyle(false)}
${document.getElementById("pluginsStyle").innerHTML}
${getSnippetCSS()}
</style>
</head>
<body>

View file

@ -218,7 +218,7 @@ export const setInlineStyle = (set = true) => {
.protyle-wysiwyg .h5 img.emoji, .b3-typography h5 img.emoji {width:${Math.floor(window.siyuan.config.editor.fontSize * 1.13 * 1.25)}px}
.protyle-wysiwyg .h6 img.emoji, .b3-typography h6 img.emoji {width:${Math.floor(window.siyuan.config.editor.fontSize * 1.25)}px}`;
if (window.siyuan.config.editor.fontFamily) {
style += `\n.b3-typography:not(.b3-typography--default), .protyle {font-family: "${window.siyuan.config.editor.fontFamily}", var(--b3-font-family)}`;
style += `\n.b3-typography:not(.b3-typography--default), .protyle-wysiwyg, .protyle-title {font-family: "${window.siyuan.config.editor.fontFamily}", var(--b3-font-family)}`;
}
// pad 端菜单移除显示,如工作空间
if ("ontouchend" in document) {