Browse Source

fix: handle existing direction

pull/2161/head
Wing-Kam Wong 3 years ago
parent
commit
fa7da4c43d
  1. 7
      packages/nc-gui/components/utils/Language.vue

7
packages/nc-gui/components/utils/Language.vue

@ -90,8 +90,11 @@ export default {
}, },
methods: { methods: {
applyDirection() { applyDirection() {
document.body.classList.add(this.isRtlLang() ? "rtl" : "ltr"); const targetDirection = this.isRtlLang() ? 'rtl' : 'ltr'
document.body.style.direction = this.isRtlLang() ? "rtl" : "ltr"; const oppositeDirection = targetDirection == 'ltr' ? 'rtl' : 'ltr'
document.body.classList.remove(oppositeDirection)
document.body.classList.add(targetDirection)
document.body.style.direction = targetDirection
}, },
isRtlLang() { isRtlLang() {
return ['fa'].includes(this.language) return ['fa'].includes(this.language)

Loading…
Cancel
Save