mohamedsabil83 / filament-forms-tinyeditor

A TinyMce Editor component for filament
MIT License
164 stars 37 forks source link

[Bug]: direction doesn't change when locale change using spatie-laravel-translatable-plugin ( for RTL languages) #103

Closed malozaibi closed 8 months ago

malozaibi commented 8 months ago

What happened?

I use spatie-laravel-translatable-plugin that is responsible for language translations. I use Arabic (RTL) and English (LTR).

However the direction stays same as the Layout language not the language of the translation package.

How to reproduce the bug

use spatie-laravel-translatable-plugin make model field translatable by the spatie laravel package use ar and en for the package

use TinyEditor in the form fields for the translatable field change the language using the LocaleSwitcher action button

direction doesn't change for ar or en. It just keeps as the Panel Layout language direction.

Package Version

2.0

PHP Version

8.1

Laravel Version

10

Which operating systems does with happen with?

macOS

Notes

I used to use Voyager Admin Panel and I override the directionality: 'rtl | ltr' using js when the language change and rebuild the tinyMCE editor on every click to language switcher. However filament uses A different world with livewire and alpine witch I find harder to customize (for now at least).

Thank you.

mohamedsabil83 commented 8 months ago

I have this in my improvement plans, but I can do something for now.

mohamedsabil83 commented 8 months ago

Tagged v2.0.6. Now, you can use ->language(fn ($livewire) => $livewire->activeLocale), and the editor interface will change related to the language chosen from LocaleSwitcher.

malozaibi commented 8 months ago

Tagged v2.0.6. Now, you can use ->language(fn ($livewire) => $livewire->activeLocale), and the editor interface will change related to the language chosen from LocaleSwitcher.

It is solved. Thank you very much.

mohamedsabil83 commented 8 months ago

You're welcome