mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-02 22:21:28 +08:00
This commit is contained in:
parent
2c8d552d72
commit
7ded2d4077
@ -41,7 +41,7 @@ export const loadPlugins = async (app: App, names?: string[]) => {
|
|||||||
});
|
});
|
||||||
const pluginsStyle = document.getElementById("pluginsStyle");
|
const pluginsStyle = document.getElementById("pluginsStyle");
|
||||||
if (pluginsStyle) {
|
if (pluginsStyle) {
|
||||||
pluginsStyle.innerHTML = css;
|
pluginsStyle.insertAdjacentHTML("afterend", css);
|
||||||
} else {
|
} else {
|
||||||
document.head.insertAdjacentHTML("beforeend", css);
|
document.head.insertAdjacentHTML("beforeend", css);
|
||||||
}
|
}
|
||||||
|
@ -8,12 +8,23 @@ import {afterExport} from "./util";
|
|||||||
/// #endif
|
/// #endif
|
||||||
import {confirmDialog} from "../../dialog/confirmDialog";
|
import {confirmDialog} from "../../dialog/confirmDialog";
|
||||||
import {getThemeMode, setInlineStyle} from "../../util/assets";
|
import {getThemeMode, setInlineStyle} from "../../util/assets";
|
||||||
import {fetchPost} from "../../util/fetch";
|
import {fetchPost, fetchSyncPost} from "../../util/fetch";
|
||||||
import {Dialog} from "../../dialog";
|
import {Dialog} from "../../dialog";
|
||||||
import {replaceLocalPath} from "../../editor/rename";
|
import {replaceLocalPath} from "../../editor/rename";
|
||||||
import {setStorageVal} from "../util/compatibility";
|
import {setStorageVal} from "../util/compatibility";
|
||||||
import {isPaidUser} from "../../util/needSubscribe";
|
import {isPaidUser} from "../../util/needSubscribe";
|
||||||
import {getCloudURL} from "../../config/util/about";
|
import {getCloudURL} from "../../config/util/about";
|
||||||
|
import {getFrontend} from "../../util/functions";
|
||||||
|
|
||||||
|
const getPluginStyle = async () => {
|
||||||
|
const response = await fetchSyncPost("/api/petal/loadPetals", {frontend: getFrontend()});
|
||||||
|
let css = '';
|
||||||
|
// 为加快启动速度,不进行 await
|
||||||
|
response.data.forEach((item: IPluginData) => {
|
||||||
|
css += item.css || "";
|
||||||
|
});
|
||||||
|
return css;
|
||||||
|
};
|
||||||
|
|
||||||
export const saveExport = (option: IExportOptions) => {
|
export const saveExport = (option: IExportOptions) => {
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
@ -170,7 +181,7 @@ const renderPDF = async (id: string) => {
|
|||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
${await setInlineStyle(false)}
|
${await setInlineStyle(false)}
|
||||||
${document.getElementById("pluginsStyle").innerHTML}
|
${await getPluginStyle()}
|
||||||
${getSnippetCSS()}
|
${getSnippetCSS()}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
@ -673,7 +684,7 @@ const onExport = async (data: IWebSocketData, filePath: string, exportOption: IE
|
|||||||
<style>
|
<style>
|
||||||
body {font-family: var(--b3-font-family);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)}
|
||||||
${await setInlineStyle(false)}
|
${await setInlineStyle(false)}
|
||||||
${document.getElementById("pluginsStyle").innerHTML}
|
${await getPluginStyle()}
|
||||||
${getSnippetCSS()}
|
${getSnippetCSS()}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
Loading…
Reference in New Issue
Block a user