mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
feat(rtl): apply same mechanism for login/desktop/mobile
This commit is contained in:
parent
6f51d82f82
commit
2936a537cf
@ -1,7 +1,7 @@
|
|||||||
import $ from "jquery";
|
import $ from "jquery";
|
||||||
|
|
||||||
async function loadBootstrap() {
|
async function loadBootstrap() {
|
||||||
if (glob.isRtl) {
|
if (document.body.dir === "rtl") {
|
||||||
await import("bootstrap/dist/css/bootstrap.rtl.min.css");
|
await import("bootstrap/dist/css/bootstrap.rtl.min.css");
|
||||||
} else {
|
} else {
|
||||||
await import("bootstrap/dist/css/bootstrap.min.css");
|
await import("bootstrap/dist/css/bootstrap.min.css");
|
||||||
|
@ -9,7 +9,11 @@
|
|||||||
<link rel="manifest" crossorigin="use-credentials" href="manifest.webmanifest">
|
<link rel="manifest" crossorigin="use-credentials" href="manifest.webmanifest">
|
||||||
<title>Trilium Notes</title>
|
<title>Trilium Notes</title>
|
||||||
</head>
|
</head>
|
||||||
<body id="trilium-app" class="desktop heading-style-<%= headingStyle %> layout-<%= layoutOrientation %> platform-<%= platform %> <%= isElectron ? 'electron' : '' %> <%= hasNativeTitleBar ? 'native-titlebar' : '' %> <%= hasBackgroundEffects ? 'background-effects' : '' %>">
|
<body
|
||||||
|
id="trilium-app"
|
||||||
|
class="desktop heading-style-<%= headingStyle %> layout-<%= layoutOrientation %> platform-<%= platform %> <%= isElectron ? 'electron' : '' %> <%= hasNativeTitleBar ? 'native-titlebar' : '' %> <%= hasBackgroundEffects ? 'background-effects' : '' %>"
|
||||||
|
lang="<%= currentLocale.id %>" dir="<%= currentLocale.rtl ? 'rtl' : 'ltr' %>"
|
||||||
|
>
|
||||||
<noscript><%= t("javascript-required") %></noscript>
|
<noscript><%= t("javascript-required") %></noscript>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<link rel="stylesheet" href="<%= assetPath %>/stylesheets/theme-next.css">
|
<link rel="stylesheet" href="<%= assetPath %>/stylesheets/theme-next.css">
|
||||||
<link rel="stylesheet" href="<%= assetPath %>/stylesheets/style.css">
|
<link rel="stylesheet" href="<%= assetPath %>/stylesheets/style.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body lang="<%= currentLocale.id %>" dir="<%= currentLocale.rtl ? 'rtl' : 'ltr' %>">
|
||||||
<div class="container login-page">
|
<div class="container login-page">
|
||||||
<div class="col-xs-12 col-sm-10 col-md-6 col-lg-4 col-xl-4 mx-auto pt-4">
|
<div class="col-xs-12 col-sm-10 col-md-6 col-lg-4 col-xl-4 mx-auto pt-4">
|
||||||
<img class="img-fluid d-block mx-auto" style="height: 8rem;" src="<%= assetPathFragment %>/images/icon-color.svg" aria-hidden="true" draggable="false" >
|
<img class="img-fluid d-block mx-auto" style="height: 8rem;" src="<%= assetPathFragment %>/images/icon-color.svg" aria-hidden="true" draggable="false" >
|
||||||
|
@ -97,7 +97,10 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body class="mobile heading-style-<%= headingStyle %>">
|
<body
|
||||||
|
class="mobile heading-style-<%= headingStyle %>"
|
||||||
|
lang="<%= currentLocale.id %>" dir="<%= currentLocale.rtl ? 'rtl' : 'ltr' %>"
|
||||||
|
>
|
||||||
<noscript><%= t("javascript-required") %></noscript>
|
<noscript><%= t("javascript-required") %></noscript>
|
||||||
|
|
||||||
<div id="toast-container" class="d-flex flex-column justify-content-center align-items-center"></div>
|
<div id="toast-container" class="d-flex flex-column justify-content-center align-items-center"></div>
|
||||||
|
@ -19,6 +19,6 @@
|
|||||||
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 %>
|
isRtl: <%= !!currentLocale.isRtl %>
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
@ -14,7 +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";
|
import { getCurrentLocale } from "../services/i18n.js";
|
||||||
|
|
||||||
function index(req: Request, res: Response) {
|
function index(req: Request, res: Response) {
|
||||||
const options = optionService.getOptionMap();
|
const options = optionService.getOptionMap();
|
||||||
@ -59,7 +59,7 @@ function index(req: Request, res: Response) {
|
|||||||
triliumVersion: packageJson.version,
|
triliumVersion: packageJson.version,
|
||||||
assetPath: assetPath,
|
assetPath: assetPath,
|
||||||
appPath: appPath,
|
appPath: appPath,
|
||||||
isRtl: !!LOCALES.find(l => l.id === options.locale)?.rtl
|
currentLocale: getCurrentLocale()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import totp from '../services/totp.js';
|
|||||||
import recoveryCodeService from '../services/encryption/recovery_codes.js';
|
import recoveryCodeService from '../services/encryption/recovery_codes.js';
|
||||||
import openID from '../services/open_id.js';
|
import openID from '../services/open_id.js';
|
||||||
import openIDEncryption from '../services/encryption/open_id_encryption.js';
|
import openIDEncryption from '../services/encryption/open_id_encryption.js';
|
||||||
|
import { getCurrentLocale } from "../services/i18n.js";
|
||||||
|
|
||||||
function loginPage(req: Request, res: Response) {
|
function loginPage(req: Request, res: Response) {
|
||||||
// Login page is triggered twice. Once here, and another time if the password is failed.
|
// Login page is triggered twice. Once here, and another time if the password is failed.
|
||||||
@ -24,6 +25,7 @@ function loginPage(req: Request, res: Response) {
|
|||||||
assetPath: assetPath,
|
assetPath: assetPath,
|
||||||
assetPathFragment: assetUrlFragment,
|
assetPathFragment: assetUrlFragment,
|
||||||
appPath: appPath,
|
appPath: appPath,
|
||||||
|
currentLocale: getCurrentLocale()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,3 +76,10 @@ export async function changeLanguage(locale: string) {
|
|||||||
await i18next.changeLanguage(locale);
|
await i18next.changeLanguage(locale);
|
||||||
hidden_subtree.checkHiddenSubtree(true, { restoreNames: true });
|
hidden_subtree.checkHiddenSubtree(true, { restoreNames: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getCurrentLocale() {
|
||||||
|
const localeId = options.getOptionOrNull("locale") ?? "en";
|
||||||
|
const currentLocale = LOCALES.find(l => l.id === localeId);
|
||||||
|
if (!currentLocale) return LOCALES.find(l => l.id === "en")!;
|
||||||
|
return currentLocale;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user