Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(design): preserve gallery controls in RTL (#7419)

白熱01c30db9aa8d
diff --git a/packages/design/src/components/gallery/Gallery.tsx b/packages/design/src/components/gallery/Gallery.tsx
index 3c7b9b550c..7fbd2c28e4 100644
--- a/packages/design/src/components/gallery/Gallery.tsx
+++ b/packages/design/src/components/gallery/Gallery.tsx
@@ -158,6 +158,7 @@ export function Gallery(props: IGalleryProps) {
univer-absolute univer-bottom-6 univer-left-1/2 univer-flex -univer-translate-x-1/2
univer-items-center univer-gap-3 univer-rounded-full univer-bg-gray-800 univer-px-6 univer-py-3
univer-text-gray-400
+ rtl:univer-flex-row-reverse
`}
>
{hasPagination && (
diff --git a/packages/design/src/components/gallery/__tests__/index.spec.tsx b/packages/design/src/components/gallery/__tests__/Gallery.spec.tsx
similarity index 94%
rename from packages/design/src/components/gallery/__tests__/index.spec.tsx
rename to packages/design/src/components/gallery/__tests__/Gallery.spec.tsx
index d224b16f31..75bbc48525 100644
--- a/packages/design/src/components/gallery/__tests__/index.spec.tsx
+++ b/packages/design/src/components/gallery/__tests__/Gallery.spec.tsx
@@ -84,6 +84,16 @@ describe('Gallery', () => {
expect(screen.getByRole('button', { name: /reset zoom/i })).toBeInTheDocument();
});
+ it('keeps the toolbar controls in logical order in RTL', () => {
+ render(
+ <ConfigProvider locale={enUS.design} direction="rtl" mountContainer={document.body}>
+ <Gallery images={images} open />
+ </ConfigProvider>
+ );
+
+ expect(screen.getByRole('dialog').querySelector('footer')).toHaveClass('rtl:univer-flex-row-reverse');
+ });
+
it('zoom in/out/reset buttons adjust the image scale', () => {
renderGallery({ images, open: true });
const img = screen.getByRole('img');