fix(client/rtl): bootstrap not in RTL mode

This commit is contained in:
Elian Doran 2025-10-08 18:50:27 +03:00
parent d9bfa08672
commit 9d1e89268f
No known key found for this signature in database
9 changed files with 16 additions and 8 deletions

View File

@ -10,7 +10,6 @@ import { t } from "./services/i18n.js";
import options from "./services/options.js"; import options from "./services/options.js";
import type ElectronRemote from "@electron/remote"; import type ElectronRemote from "@electron/remote";
import type Electron from "electron"; import type Electron from "electron";
import "bootstrap/dist/css/bootstrap.min.css";
import "boxicons/css/boxicons.min.css"; import "boxicons/css/boxicons.min.css";
import "autocomplete.js/index_jquery.js"; import "autocomplete.js/index_jquery.js";

View File

@ -1,5 +1,3 @@
import "bootstrap/dist/css/bootstrap.min.css";
// @ts-ignore - module = undefined // @ts-ignore - module = undefined
// Required for correct loading of scripts in Electron // Required for correct loading of scripts in Electron
if (typeof module === 'object') {window.module = module; module = undefined;} if (typeof module === 'object') {window.module = module; module = undefined;}

View File

@ -1,7 +1,6 @@
import appContext from "./components/app_context.js"; import appContext from "./components/app_context.js";
import noteAutocompleteService from "./services/note_autocomplete.js"; import noteAutocompleteService from "./services/note_autocomplete.js";
import glob from "./services/glob.js"; import glob from "./services/glob.js";
import "bootstrap/dist/css/bootstrap.min.css";
import "boxicons/css/boxicons.min.css"; import "boxicons/css/boxicons.min.css";
import "autocomplete.js/index_jquery.js"; import "autocomplete.js/index_jquery.js";

View File

@ -1,5 +1,15 @@
import $ from "jquery"; 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).$ = $;
(window as any).jQuery = $; (window as any).jQuery = $;
await loadBootstrap();
$("body").show(); $("body").show();

View File

@ -1,4 +1,3 @@
import "bootstrap/dist/css/bootstrap.min.css";
import "./stylesheets/auth.css"; import "./stylesheets/auth.css";
// @TriliumNextTODO: is this even needed anymore? // @TriliumNextTODO: is this even needed anymore?

View File

@ -1,7 +1,6 @@
import "jquery"; import "jquery";
import utils from "./services/utils.js"; import utils from "./services/utils.js";
import ko from "knockout"; import ko from "knockout";
import "bootstrap/dist/css/bootstrap.min.css";
// TriliumNextTODO: properly make use of below types // TriliumNextTODO: properly make use of below types
// type SetupModelSetupType = "new-document" | "sync-from-desktop" | "sync-from-server" | ""; // type SetupModelSetupType = "new-document" | "sync-from-desktop" | "sync-from-server" | "";

View File

@ -46,6 +46,7 @@ interface CustomGlobals {
platform?: typeof process.platform; platform?: typeof process.platform;
linter: typeof lint; linter: typeof lint;
hasNativeTitleBar: boolean; hasNativeTitleBar: boolean;
isRtl: boolean;
} }
type RequireMethod = (moduleName: string) => any; type RequireMethod = (moduleName: string) => any;

View File

@ -18,6 +18,7 @@
appPath: "<%= appPath %>", appPath: "<%= appPath %>",
platform: "<%= platform %>", platform: "<%= platform %>",
hasNativeTitleBar: <%= hasNativeTitleBar %>, hasNativeTitleBar: <%= hasNativeTitleBar %>,
TRILIUM_SAFE_MODE: <%= !!process.env.TRILIUM_SAFE_MODE %> TRILIUM_SAFE_MODE: <%= !!process.env.TRILIUM_SAFE_MODE %>,
isRtl: <%= isRtl %>
}; };
</script> </script>

View File

@ -14,6 +14,7 @@ import { generateToken as generateCsrfToken } from "./csrf_protection.js";
import type { Request, Response } from "express"; import type { Request, Response } from "express";
import type BNote from "../becca/entities/bnote.js"; import type BNote from "../becca/entities/bnote.js";
import { LOCALES } from "@triliumnext/commons";
function index(req: Request, res: Response) { function index(req: Request, res: Response) {
const options = optionService.getOptionMap(); const options = optionService.getOptionMap();
@ -57,7 +58,8 @@ function index(req: Request, res: Response) {
maxContentWidth: Math.max(640, parseInt(options.maxContentWidth)), maxContentWidth: Math.max(640, parseInt(options.maxContentWidth)),
triliumVersion: packageJson.version, triliumVersion: packageJson.version,
assetPath: assetPath, assetPath: assetPath,
appPath: appPath appPath: appPath,
isRtl: LOCALES.find(l => l.id === options.locale)?.rtl
}); });
} }