diff --git a/apps/client/src/desktop.ts b/apps/client/src/desktop.ts index 6fa428656..cca6c8c0f 100644 --- a/apps/client/src/desktop.ts +++ b/apps/client/src/desktop.ts @@ -10,7 +10,6 @@ import { t } from "./services/i18n.js"; import options from "./services/options.js"; import type ElectronRemote from "@electron/remote"; import type Electron from "electron"; -import "bootstrap/dist/css/bootstrap.min.css"; import "boxicons/css/boxicons.min.css"; import "autocomplete.js/index_jquery.js"; diff --git a/apps/client/src/login.ts b/apps/client/src/login.ts index 351ed4c1e..e70767840 100644 --- a/apps/client/src/login.ts +++ b/apps/client/src/login.ts @@ -1,5 +1,3 @@ -import "bootstrap/dist/css/bootstrap.min.css"; - // @ts-ignore - module = undefined // Required for correct loading of scripts in Electron if (typeof module === 'object') {window.module = module; module = undefined;} diff --git a/apps/client/src/mobile.ts b/apps/client/src/mobile.ts index 507b9ff5a..f4daedc16 100644 --- a/apps/client/src/mobile.ts +++ b/apps/client/src/mobile.ts @@ -1,7 +1,6 @@ import appContext from "./components/app_context.js"; import noteAutocompleteService from "./services/note_autocomplete.js"; import glob from "./services/glob.js"; -import "bootstrap/dist/css/bootstrap.min.css"; import "boxicons/css/boxicons.min.css"; import "autocomplete.js/index_jquery.js"; diff --git a/apps/client/src/runtime.ts b/apps/client/src/runtime.ts index 50c385778..9de27af18 100644 --- a/apps/client/src/runtime.ts +++ b/apps/client/src/runtime.ts @@ -1,5 +1,15 @@ import $ from "jquery"; + +async function loadBootstrap() { + if (glob.isRtl) { + 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(); diff --git a/apps/client/src/set_password.ts b/apps/client/src/set_password.ts index 47e02f1d1..13be761ec 100644 --- a/apps/client/src/set_password.ts +++ b/apps/client/src/set_password.ts @@ -1,4 +1,3 @@ -import "bootstrap/dist/css/bootstrap.min.css"; import "./stylesheets/auth.css"; // @TriliumNextTODO: is this even needed anymore? diff --git a/apps/client/src/setup.ts b/apps/client/src/setup.ts index d5659645e..29fbd15c0 100644 --- a/apps/client/src/setup.ts +++ b/apps/client/src/setup.ts @@ -1,7 +1,6 @@ import "jquery"; import utils from "./services/utils.js"; import ko from "knockout"; -import "bootstrap/dist/css/bootstrap.min.css"; // TriliumNextTODO: properly make use of below types // type SetupModelSetupType = "new-document" | "sync-from-desktop" | "sync-from-server" | ""; diff --git a/apps/client/src/types.d.ts b/apps/client/src/types.d.ts index fedad1662..36b56b9a6 100644 --- a/apps/client/src/types.d.ts +++ b/apps/client/src/types.d.ts @@ -46,6 +46,7 @@ interface CustomGlobals { platform?: typeof process.platform; linter: typeof lint; hasNativeTitleBar: boolean; + isRtl: boolean; } type RequireMethod = (moduleName: string) => any; diff --git a/apps/server/src/assets/views/partials/windowGlobal.ejs b/apps/server/src/assets/views/partials/windowGlobal.ejs index 1258030d1..33b42c5f9 100644 --- a/apps/server/src/assets/views/partials/windowGlobal.ejs +++ b/apps/server/src/assets/views/partials/windowGlobal.ejs @@ -18,6 +18,7 @@ appPath: "<%= appPath %>", platform: "<%= platform %>", hasNativeTitleBar: <%= hasNativeTitleBar %>, - TRILIUM_SAFE_MODE: <%= !!process.env.TRILIUM_SAFE_MODE %> + TRILIUM_SAFE_MODE: <%= !!process.env.TRILIUM_SAFE_MODE %>, + isRtl: <%= isRtl %> }; \ No newline at end of file diff --git a/apps/server/src/routes/index.ts b/apps/server/src/routes/index.ts index 430c27d0f..2f579edaf 100644 --- a/apps/server/src/routes/index.ts +++ b/apps/server/src/routes/index.ts @@ -14,6 +14,7 @@ import { generateToken as generateCsrfToken } from "./csrf_protection.js"; import type { Request, Response } from "express"; import type BNote from "../becca/entities/bnote.js"; +import { LOCALES } from "@triliumnext/commons"; function index(req: Request, res: Response) { const options = optionService.getOptionMap(); @@ -57,7 +58,8 @@ function index(req: Request, res: Response) { maxContentWidth: Math.max(640, parseInt(options.maxContentWidth)), triliumVersion: packageJson.version, assetPath: assetPath, - appPath: appPath + appPath: appPath, + isRtl: LOCALES.find(l => l.id === options.locale)?.rtl }); }