Update: 调整板卡载入方式

This commit is contained in:
王立帮
2024-10-04 21:32:49 +08:00
parent b4498b4827
commit 7ae1238fd2

View File

@@ -66,12 +66,18 @@ window.addEventListener('load', () => {
break; break;
} }
} }
if (!$categories.children('category').length) { $categories && $('#toolbox').html($categories.html());
$categories.html('<category></category>'); cssPaths.length && LazyLoad.css(cssPaths);
} if (scrpitPaths.length) {
$('#toolbox').html($categories.html());
LazyLoad.css(cssPaths);
LazyLoad.js(scrpitPaths, () => { LazyLoad.js(scrpitPaths, () => {
Loader.start();
});
} else {
Loader.start();
}
});
Loader.start = () => {
if (window.frames.length !== parent.frames.length) { if (window.frames.length !== parent.frames.length) {
window.userEvents = new UserEvents(Editor.blockEditor); window.userEvents = new UserEvents(Editor.blockEditor);
} }
@@ -87,8 +93,7 @@ window.addEventListener('load', () => {
Env.defaultXML = $('#toolbox').html(); Env.defaultXML = $('#toolbox').html();
Loader.init(); Loader.init();
} }
}); }
});
Loader.init = () => { Loader.init = () => {
const selectedBoardName = Boards.getSelectedBoardName(); const selectedBoardName = Boards.getSelectedBoardName();