Skip to content

Commit efbc7fa

Browse files
committed
fix(RTL): initialize language direction check once in utils
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
1 parent 9c25a15 commit efbc7fa

File tree

5 files changed

+21
-13
lines changed

5 files changed

+21
-13
lines changed

src/components/NcActionButton/NcActionButton.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,8 @@ export default {
355355
<span v-else class="action-button__text">{{ text }}</span>
356356

357357
<!-- right(in LTR) or left(in RTL) arrow icon when there is a sub-menu -->
358-
<ChevronRightIcon v-if="isMenu && !isRTL" :size="20" class="action-button__menu-icon" />
359-
<ChevronLeftIcon v-else-if="isMenu && isRTL" :size="20" class="action-button__menu-icon" />
358+
<ChevronRightIcon v-if="isMenu && !isRtl" :size="20" class="action-button__menu-icon" />
359+
<ChevronLeftIcon v-else-if="isMenu && isRtl" :size="20" class="action-button__menu-icon" />
360360
<CheckIcon v-else-if="isChecked === true" :size="20" class="action-button__pressed-icon" />
361361
<span v-else-if="isChecked === false" class="action-button__pressed-icon material-design-icon" />
362362

@@ -371,7 +371,7 @@ import CheckIcon from 'vue-material-design-icons/Check.vue'
371371
import ChevronRightIcon from 'vue-material-design-icons/ChevronRight.vue'
372372
import ChevronLeftIcon from 'vue-material-design-icons/ChevronLeft.vue'
373373
import ActionTextMixin from '../../mixins/actionText.js'
374-
import { isRTL } from '@nextcloud/l10n'
374+
import { isRtl } from '../../utils/rtl.ts'
375375
376376
/**
377377
* Button component to be used in Actions
@@ -386,7 +386,7 @@ export default {
386386
},
387387
setup() {
388388
return {
389-
isRTL: isRTL(),
389+
isRtl,
390390
}
391391
},
392392
mixins: [ActionTextMixin],

src/components/NcActionTextEditable/NcActionTextEditable.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export default {
8282
<!-- allow the custom font to inject a ::before
8383
not possible on input[type=submit] -->
8484
<label v-show="!disabled" :for="id" class="action-text-editable__label">
85-
<ArrowLeft v-if="isRTL" :size="20" />
85+
<ArrowLeft v-if="isRtl" :size="20" />
8686
<ArrowRight v-else :size="20" />
8787
</label>
8888
</form>
@@ -98,7 +98,7 @@ import GenRandomId from '../../utils/GenRandomId.js'
9898
import ArrowLeft from 'vue-material-design-icons/ArrowLeft.vue'
9999
import ArrowRight from 'vue-material-design-icons/ArrowRight.vue'
100100
101-
import { isRTL } from '@nextcloud/l10n'
101+
import { isRtl } from '../../utils/rtl.ts'
102102
103103
export default {
104104
name: 'NcActionTextEditable',
@@ -170,7 +170,7 @@ export default {
170170
const model = useModelMigration('value', 'update:value')
171171
return {
172172
model,
173-
isRTL: isRTL(),
173+
isRtl,
174174
}
175175
},
176176

src/components/NcAppContent/NcAppContent.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ The list size must be between the min and the max width value.
7777
:class="{ 'splitpanes--horizontal': layout === 'horizontal-split',
7878
'splitpanes--vertical': layout === 'vertical-split'
7979
}"
80-
:rtl="isRTL"
80+
:rtl="isRtl"
8181
@resized="handlePaneResize">
8282
<Pane class="splitpanes__pane-list"
8383
:size="listPaneSize || paneDefaults.list.size"
@@ -112,7 +112,7 @@ import { Splitpanes, Pane } from 'splitpanes'
112112
113113
import 'splitpanes/dist/splitpanes.css'
114114
import { emit } from '@nextcloud/event-bus'
115-
import { isRTL } from '@nextcloud/l10n'
115+
import { isRtl } from '../../utils/rtl.ts'
116116
117117
const browserStorage = getBuilder('nextcloud').persist().build()
118118
@@ -227,7 +227,7 @@ export default {
227227
setup() {
228228
return {
229229
isMobile: useIsMobile(),
230-
isRTL: isRTL(),
230+
isRtl,
231231
}
232232
},
233233

src/components/NcAppContent/NcAppDetailsToggle.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class="app-details-toggle"
1111
:class="{ 'app-details-toggle--mobile': isMobile }">
1212
<template #icon>
13-
<ArrowLeft v-if="isRTL" :size="20" />
13+
<ArrowLeft v-if="isRtl" :size="20" />
1414
<ArrowRight v-else :size="20" />
1515
</template>
1616
</NcButton>
@@ -27,7 +27,7 @@ import ArrowRight from 'vue-material-design-icons/ArrowRight.vue'
2727
import ArrowLeft from 'vue-material-design-icons/ArrowLeft.vue'
2828
2929
import { useIsMobile } from '../../composables/useIsMobile/index.js'
30-
import { isRTL } from '@nextcloud/l10n'
30+
import { isRtl } from '../../utils/rtl.ts'
3131
3232
export default {
3333
name: 'NcAppDetailsToggle',
@@ -43,7 +43,7 @@ export default {
4343
},
4444
setup() {
4545
return {
46-
isRTL: isRTL(),
46+
isRtl,
4747
isMobile: useIsMobile(),
4848
}
4949
},

src/utils/rtl.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3+
* SPDX-License-Identifier: AGPL-3.0-or-later
4+
*/
5+
6+
import { isRTL } from '@nextcloud/l10n'
7+
8+
export const isRtl = isRTL()

0 commit comments

Comments
 (0)