Replies: 1 comment
-
Honestly, I'm not sure of the best place to do this. Maybe a hintAction on the field itself so it has access to the fields state and the component through the ->action() callback. Then, if you aren't storing the content as json you can use the converter class to morph it into json and loop the ast tree there then use $component->state($newState) in the ->action() modifier. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello All,
My model has a translatable field (content) where I store the translations in JSON format. I built my form with spatie translatable filament plugin. Works well so far.
I want to add a translation feature: in case the user entered the english (default) texts/images/other elements then switch to other locale, there would be a translation button. By clicking this button, a script would copy the english content array, iterate through it, then the all 'text' keys would be passed to the google translate and set back to the tiptap instance.
My biggest problem here, I don't know how to manipulate the data of tiptap editor instance. I tried the Set $set('content', $arrayOfContent) but it did not work.
How would you implement such a feature?
Beta Was this translation helpful? Give feedback.
All reactions