mirror of
https://github.com/zadam/trilium.git
synced 2026-01-11 09:04:28 +01:00
refactor(client): get rid of runtime in favor of bootstrap script
This commit is contained in:
parent
ac3ae0dbbe
commit
2e845a9faa
@ -1,9 +1,16 @@
|
||||
import $ from "jquery";
|
||||
|
||||
async function bootstrap() {
|
||||
(window as any).$ = $;
|
||||
(window as any).jQuery = $;
|
||||
|
||||
await setupGlob();
|
||||
await loadBootstrapCss();
|
||||
loadStylesheets();
|
||||
loadIcons();
|
||||
setBodyAttributes();
|
||||
await loadScripts();
|
||||
hideSplash();
|
||||
}
|
||||
|
||||
async function setupGlob() {
|
||||
@ -17,6 +24,15 @@ async function setupGlob() {
|
||||
};
|
||||
}
|
||||
|
||||
async function loadBootstrapCss() {
|
||||
// We have to selectively import Bootstrap CSS based on text direction.
|
||||
if (document.body.dir === "rtl") {
|
||||
await import("bootstrap/dist/css/bootstrap.rtl.min.css");
|
||||
} else {
|
||||
await import("bootstrap/dist/css/bootstrap.min.css");
|
||||
}
|
||||
}
|
||||
|
||||
function loadStylesheets() {
|
||||
const { assetPath, themeCssUrl, themeUseNextAsBase } = window.glob;
|
||||
const cssToLoad: string[] = [];
|
||||
@ -70,7 +86,6 @@ function setBodyAttributes() {
|
||||
}
|
||||
|
||||
async function loadScripts() {
|
||||
await import("./runtime.js");
|
||||
if (glob.device === "mobile") {
|
||||
await import("./mobile.js");
|
||||
} else {
|
||||
@ -78,4 +93,8 @@ async function loadScripts() {
|
||||
}
|
||||
}
|
||||
|
||||
function hideSplash() {
|
||||
$("body").show();
|
||||
}
|
||||
|
||||
bootstrap();
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
import $ from "jquery";
|
||||
|
||||
async function loadBootstrap() {
|
||||
if (document.body.dir === "rtl") {
|
||||
await import("bootstrap/dist/css/bootstrap.rtl.min.css");
|
||||
} else {
|
||||
await import("bootstrap/dist/css/bootstrap.min.css");
|
||||
}
|
||||
}
|
||||
|
||||
(window as any).$ = $;
|
||||
(window as any).jQuery = $;
|
||||
await loadBootstrap();
|
||||
|
||||
$("body").show();
|
||||
@ -74,7 +74,6 @@ export default defineConfig(() => ({
|
||||
login: join(__dirname, "src", "login.ts"),
|
||||
setup: join(__dirname, "src", "setup.ts"),
|
||||
set_password: join(__dirname, "src", "set_password.ts"),
|
||||
runtime: join(__dirname, "src", "runtime.ts"),
|
||||
print: join(__dirname, "src", "print.tsx")
|
||||
},
|
||||
output: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user