Update: 调整板卡载入方式

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

View File

@@ -66,30 +66,35 @@ window.addEventListener('load', () => {
break;
}
}
if (!$categories.children('category').length) {
$categories.html('<category></category>');
$categories && $('#toolbox').html($categories.html());
cssPaths.length && LazyLoad.css(cssPaths);
if (scrpitPaths.length) {
LazyLoad.js(scrpitPaths, () => {
Loader.start();
});
} else {
Loader.start();
}
$('#toolbox').html($categories.html());
LazyLoad.css(cssPaths);
LazyLoad.js(scrpitPaths, () => {
if (window.frames.length !== parent.frames.length) {
window.userEvents = new UserEvents(Editor.blockEditor);
}
if (!goog.isElectron && window.location.host.indexOf('mixly.cn')) {
window.userOpEvents = new UserOPEvents();
}
if (Env.hasSocketServer) {
Socket.init();
}
if (goog.isElectron && typeof LibManager === 'object') {
LibManager.init(() => Loader.init());
} else {
Env.defaultXML = $('#toolbox').html();
Loader.init();
}
});
});
Loader.start = () => {
if (window.frames.length !== parent.frames.length) {
window.userEvents = new UserEvents(Editor.blockEditor);
}
if (!goog.isElectron && window.location.host.indexOf('mixly.cn')) {
window.userOpEvents = new UserOPEvents();
}
if (Env.hasSocketServer) {
Socket.init();
}
if (goog.isElectron && typeof LibManager === 'object') {
LibManager.init(() => Loader.init());
} else {
Env.defaultXML = $('#toolbox').html();
Loader.init();
}
}
Loader.init = () => {
const selectedBoardName = Boards.getSelectedBoardName();
Boards.setSelectedBoard(selectedBoardName, {});