vditor
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");
}
};