From 7ae1238fd2922fafb7477596e15e6876ac49780c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=AB=8B=E5=B8=AE?= <3294713004@qq.com> Date: Fri, 4 Oct 2024 21:32:49 +0800 Subject: [PATCH] =?UTF-8?q?Update:=20=E8=B0=83=E6=95=B4=E6=9D=BF=E5=8D=A1?= =?UTF-8?q?=E8=BD=BD=E5=85=A5=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/modules/mixly-modules/common/loader.js | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/common/modules/mixly-modules/common/loader.js b/common/modules/mixly-modules/common/loader.js index 8433c592..c5d053be 100644 --- a/common/modules/mixly-modules/common/loader.js +++ b/common/modules/mixly-modules/common/loader.js @@ -66,30 +66,35 @@ window.addEventListener('load', () => { break; } } - if (!$categories.children('category').length) { - $categories.html(''); + $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, {});