mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-07 05:10:16 +01:00
This commit is contained in:
parent
f8e49f4e13
commit
8db86ce6ca
5 changed files with 28 additions and 27 deletions
|
|
@ -7,6 +7,7 @@ import {exportLayout} from "../layout/util";
|
|||
/// #endif
|
||||
import {fetchPost} from "./fetch";
|
||||
import {isInAndroid, isInHarmony, isInIOS, isIPad, isIPhone, isMac, isWin11} from "../protyle/util/compatibility";
|
||||
import {setCodeTheme} from "../protyle/render/util";
|
||||
|
||||
export const loadAssets = (data: Config.IAppearance) => {
|
||||
const htmlElement = document.getElementsByTagName("html")[0];
|
||||
|
|
@ -319,29 +320,6 @@ export const setInlineStyle = async (set = true, servePath = "../../../") => {
|
|||
return style;
|
||||
};
|
||||
|
||||
export const setCodeTheme = (cdn = Constants.PROTYLE_CDN) => {
|
||||
const protyleHljsStyle = document.getElementById("protyleHljsStyle") as HTMLLinkElement;
|
||||
let css;
|
||||
if (window.siyuan.config.appearance.mode === 0) {
|
||||
css = window.siyuan.config.appearance.codeBlockThemeLight;
|
||||
if (!Constants.SIYUAN_CONFIG_APPEARANCE_LIGHT_CODE.includes(css)) {
|
||||
css = "default";
|
||||
}
|
||||
} else {
|
||||
css = window.siyuan.config.appearance.codeBlockThemeDark;
|
||||
if (!Constants.SIYUAN_CONFIG_APPEARANCE_DARK_CODE.includes(css)) {
|
||||
css = "github-dark";
|
||||
}
|
||||
}
|
||||
const href = `${cdn}/js/highlight.js/styles/${css}.min.css?v=11.11.1`;
|
||||
if (!protyleHljsStyle) {
|
||||
addStyle(href, "protyleHljsStyle");
|
||||
} else if (!protyleHljsStyle.href.includes(href)) {
|
||||
protyleHljsStyle.remove();
|
||||
addStyle(href, "protyleHljsStyle");
|
||||
}
|
||||
};
|
||||
|
||||
export const setMode = (modeElementValue: number) => {
|
||||
/// #if !MOBILE
|
||||
let mode = modeElementValue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue