Speedup boot.js: no need to load CKEditor/Squire when not logged in

This commit is contained in:
djmaze 2020-09-10 10:07:35 +02:00
parent a27c3befa8
commit acda0e8883
2 changed files with 17 additions and 18 deletions

View file

@ -156,20 +156,7 @@ win.__initAppData = appData => {
}
appData.IncludeCss && writeCSS(appData.IncludeCss);
}
if (
appData &&
appData.TemplatesLink &&
appData.LangLink &&
appData.StaticLibJsLink &&
appData.StaticAppJsLink &&
appData.StaticEditorJsLink
) {
p.set(5);
const libs = () =>
loadScript(appData.StaticLibJsLink).then(() => {
if (appData.IncludeBackground) {
const img = appData.IncludeBackground.replace('{{USER}}', rl.hash.get() || '0');
if (img) {
@ -177,9 +164,18 @@ win.__initAppData = appData => {
doc.body.style.backgroundImage = "url("+img+")";
}
}
});
}
libs()
if (
appData &&
appData.TemplatesLink &&
appData.LangLink &&
appData.StaticLibJsLink &&
appData.StaticAppJsLink
) {
p.set(5);
loadScript(appData.StaticLibJsLink)
.then(() => {
p.set(20);
return Promise.all([loadScript(appData.TemplatesLink), loadScript(appData.LangLink)]);
@ -200,11 +196,14 @@ win.__initAppData = appData => {
runMainBoot(true);
throw e;
})
.then(() => loadScript(appData.StaticEditorJsLink))
.then(() => {
if (appData.Auth) {
loadScript(appData.StaticEditorJsLink).then(() => {
win.__initEditor && win.__initEditor();
win.__initEditor = null;
});
}
});
} else {
runMainBoot(true);
}

2
dev/bootstrap.js vendored
View file

@ -1,4 +1,4 @@
import { data as GlobalsData, bMobileDevice, dropdownVisibility } from 'Common/Globals';
import { data as GlobalsData, dropdownVisibility } from 'Common/Globals';
import * as Enums from 'Common/Enums';
import * as Plugins from 'Common/Plugins';
import { i18n } from 'Common/Translator';