mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-19 23:06:09 +01:00
15 lines
561 B
TypeScript
15 lines
561 B
TypeScript
export const addStyle = (url: string, id: string) => {
|
|
if (!document.getElementById(id)) {
|
|
const styleElement = document.createElement("link");
|
|
styleElement.id = id;
|
|
styleElement.rel = "stylesheet";
|
|
styleElement.type = "text/css";
|
|
styleElement.href = url;
|
|
const pluginsStyle = document.querySelector("#pluginsStyle");
|
|
if (pluginsStyle) {
|
|
pluginsStyle.before(styleElement);
|
|
} else {
|
|
document.getElementsByTagName("head")[0].appendChild(styleElement);
|
|
}
|
|
}
|
|
};
|