atitor
Version:
♏ 一款现代化 Markdown 编辑器
16 lines (14 loc) • 566 B
text/typescript
import {addStyle} from "../util/addStyle";
export const setContentTheme = (contentTheme: string, path: string) => {
if (!contentTheme || !path) {
return;
}
const vditorContentTheme = document.getElementById("vditorContentTheme") as HTMLLinkElement;
const cssPath = `${path}/${contentTheme}.css`;
if (!vditorContentTheme) {
addStyle(cssPath, "vditorContentTheme");
} else if (vditorContentTheme.getAttribute("href") !== cssPath) {
vditorContentTheme.remove();
addStyle(cssPath, "vditorContentTheme");
}
};