chore: improvments in rtl
This commit is contained in:
parent
a25be32510
commit
791566b2a8
@ -100,6 +100,8 @@ const removeEmpty = (obj) =>
|
|||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const rtlLanguages = ["he", "ar"];
|
||||||
|
|
||||||
const i18n = new VueI18n({
|
const i18n = new VueI18n({
|
||||||
locale: detectLocale(),
|
locale: detectLocale(),
|
||||||
fallbackLocale: "en",
|
fallbackLocale: "en",
|
||||||
|
|||||||
@ -12,8 +12,8 @@ import ProfileSettings from "@/views/settings/Profile";
|
|||||||
import Shares from "@/views/settings/Shares";
|
import Shares from "@/views/settings/Shares";
|
||||||
import Errors from "@/views/Errors";
|
import Errors from "@/views/Errors";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import { baseURL, name, rtlLanguages } from "@/utils/constants";
|
import { baseURL, name } from "@/utils/constants";
|
||||||
import i18n from "@/i18n";
|
import i18n, { rtlLanguages } from "@/i18n";
|
||||||
|
|
||||||
Vue.use(Router);
|
Vue.use(Router);
|
||||||
|
|
||||||
@ -161,12 +161,13 @@ router.beforeEach((to, from, next) => {
|
|||||||
/*** RTL related settings per route ****/
|
/*** RTL related settings per route ****/
|
||||||
const rtlSet = document.querySelector("body").classList.contains("rtl");
|
const rtlSet = document.querySelector("body").classList.contains("rtl");
|
||||||
const shouldSetRtl = rtlLanguages.includes(i18n.locale);
|
const shouldSetRtl = rtlLanguages.includes(i18n.locale);
|
||||||
// Add RTL
|
switch (true) {
|
||||||
if (shouldSetRtl && rtlSet === false) {
|
case shouldSetRtl && !rtlSet:
|
||||||
document.querySelector("body").classList.add("rtl");
|
document.querySelector("body").classList.add("rtl");
|
||||||
//Remove RTL
|
break;
|
||||||
} else if (rtlSet === true && shouldSetRtl === false) {
|
case !shouldSetRtl && rtlSet:
|
||||||
document.querySelector("body").classList.remove("rtl");
|
document.querySelector("body").classList.remove("rtl");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (to.matched.some((record) => record.meta.requiresAuth)) {
|
if (to.matched.some((record) => record.meta.requiresAuth)) {
|
||||||
|
|||||||
@ -15,7 +15,6 @@ const enableThumbs = window.FileBrowser.EnableThumbs;
|
|||||||
const resizePreview = window.FileBrowser.ResizePreview;
|
const resizePreview = window.FileBrowser.ResizePreview;
|
||||||
const enableExec = window.FileBrowser.EnableExec;
|
const enableExec = window.FileBrowser.EnableExec;
|
||||||
const origin = window.location.origin;
|
const origin = window.location.origin;
|
||||||
const rtlLanguages = ["he", "ar"];
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
name,
|
name,
|
||||||
@ -34,5 +33,4 @@ export {
|
|||||||
resizePreview,
|
resizePreview,
|
||||||
enableExec,
|
enableExec,
|
||||||
origin,
|
origin,
|
||||||
rtlLanguages,
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -75,7 +75,7 @@
|
|||||||
import { mapState, mapMutations } from "vuex";
|
import { mapState, mapMutations } from "vuex";
|
||||||
import { users as api } from "@/api";
|
import { users as api } from "@/api";
|
||||||
import Languages from "@/components/settings/Languages";
|
import Languages from "@/components/settings/Languages";
|
||||||
import i18n from "@/i18n";
|
import i18n, { rtlLanguages } from "@/i18n";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "settings",
|
name: "settings",
|
||||||
@ -144,7 +144,9 @@ export default {
|
|||||||
singleClick: this.singleClick,
|
singleClick: this.singleClick,
|
||||||
dateFormat: this.dateFormat,
|
dateFormat: this.dateFormat,
|
||||||
};
|
};
|
||||||
const shouldReload = data.locale != i18n.locale;
|
const shouldReload =
|
||||||
|
rtlLanguages.includes(data.locale) !==
|
||||||
|
rtlLanguages.includes(i18n.locale);
|
||||||
await api.update(data, [
|
await api.update(data, [
|
||||||
"locale",
|
"locale",
|
||||||
"hideDotfiles",
|
"hideDotfiles",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user