mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 23:29:02 +02:00
feat(i18n/rtl): apply right to left direction at root level
This commit is contained in:
parent
034ac59c9a
commit
adff36cf22
@ -3,6 +3,7 @@ import FlexContainer from "./flex_container.js";
|
||||
import options from "../../services/options.js";
|
||||
import type BasicWidget from "../basic_widget.js";
|
||||
import utils from "../../services/utils.js";
|
||||
import { LOCALES } from "@triliumnext/commons";
|
||||
|
||||
/**
|
||||
* The root container is the top-most widget/container, from which the entire layout derives.
|
||||
@ -32,6 +33,7 @@ export default class RootContainer extends FlexContainer<BasicWidget> {
|
||||
this.#setMotion(options.is("motionEnabled"));
|
||||
this.#setShadows(options.is("shadowsEnabled"));
|
||||
this.#setBackdropEffects(options.is("backdropEffectsEnabled"));
|
||||
this.#setRightToLeft(options.get("locale"));
|
||||
|
||||
return super.render();
|
||||
}
|
||||
@ -68,6 +70,11 @@ export default class RootContainer extends FlexContainer<BasicWidget> {
|
||||
#setBackdropEffects(enabled: boolean) {
|
||||
document.body.classList.toggle("backdrop-effects-disabled", !enabled);
|
||||
}
|
||||
|
||||
#setRightToLeft(locale: string) {
|
||||
const correspondingLocale = LOCALES.find(l => l.id === locale);
|
||||
document.body.dir = correspondingLocale?.rtl ? "rtl" : "ltr";
|
||||
}
|
||||
}
|
||||
|
||||
function getViewportHeight() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user