Vanessa 2025-02-24 23:31:15 +08:00
parent 02f6509206
commit d40a3ac58b

View file

@ -102,16 +102,18 @@ export const loadAssets = (data: Config.IAppearance) => {
// 不能使用 data.iconVer因为其他主题也需要加载默认图标此时 data.iconVer 为其他图标的版本号
const iconURL = `/appearance/icons/${["ant", "material"].includes(data.icon) ? data.icon : "material"}/icon.js?v=${Constants.SIYUAN_VERSION}`;
if (iconDefaultScriptElement) {
iconDefaultScriptElement.remove();
let svgElement = document.body.firstElementChild;
while (svgElement.tagName === "svg") {
const currentSvgElement = svgElement;
svgElement = svgElement.nextElementSibling;
if (!currentSvgElement.getAttribute("data-name")) {
currentSvgElement.remove();
if (!iconDefaultScriptElement.getAttribute("src").startsWith(iconURL)) {
iconDefaultScriptElement.remove();
let svgElement = document.body.firstElementChild;
while (svgElement.tagName === "svg") {
const currentSvgElement = svgElement;
svgElement = svgElement.nextElementSibling;
if (!currentSvgElement.getAttribute("data-name")) {
currentSvgElement.remove();
}
}
loadThirdIcon(iconURL, data);
}
loadThirdIcon(iconURL, data);
} else {
loadThirdIcon(iconURL, data);
}