Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing methods for TranslatedText with enabled optionRichtext #1819

Open
xalabama opened this issue Jun 21, 2024 · 0 comments
Open

Missing methods for TranslatedText with enabled optionRichtext #1819

xalabama opened this issue Jun 21, 2024 · 0 comments
Labels
bug Something isn't working unconfirmed

Comments

@xalabama
Copy link
Contributor

xalabama commented Jun 21, 2024

  • Lunar version: 1.0.0-alpha.27
  • Laravel Version: 11.10.0
  • PHP Version: 8.2
  • Database Driver & Version: mariadb 10.11

Expected Behaviour:

The TranslatedText form component are missing some methods to configure if the optionRichtext is enabled. I'am looking for this methods from following Traits:

  • Filament\Forms\Components\Concerns\HasFileAttachments
  • Filament\Forms\Components\Concerns\InteractsWithToolbarButtons

The methods to configure the component in general won't be attached to the TranslatedRichEditor component, because they won't be attached to the dynamic generated components.

Methods from there should be available on the TranslatedText component. If i see it correct this is also a problem in general for the TranslatedTextInput component.

Actual Behaviour:

Configuration methods should be able to set from the TranslatedText component.

Steps To Reproduce:

Call a TranslatedText component from a form builder instance and try to call one of the methods from the described traits like

TranslatedText::make('translated_text')
    ->optionRichtext(true)
    ->toolbarButtons([]);

// or also

TranslatedText::make('translated_text')
    ->extraInputAttributes([]);

Not sure if its more a feature request than a bug, in my opinion it could be both.

I think the methods are needed to attach their values inside the TranslatedText method 'prepareChildComponents', wehere the objects are created. I can help to contribute this.

@xalabama xalabama added bug Something isn't working unconfirmed labels Jun 21, 2024
glennjacobs added a commit that referenced this issue Aug 22, 2024
This PR solves the issue
[#1819](#1819) by providing
missing configuration methods to the TranslatedText component for
RichEditor option. It also allows to pass method parameters to the child
components that they can take an effect there.

Following methods are now available for TranslatedText component: 

```php

// For enabled rich editor option only
TranslatedText::make('text-editor')
    ->optionRichtext(true)
    ->richtextToolbarButtons() // equal to toolbarButtons on RichEditor
    ->richtextDisableToolbarButtons() // equal to disableToolbarButtons on RichEditor
    ->richtextDisableAllToolbarButtons() // equal to disableAllToolbarButtons on RichEditor
    ->richtextFileAttachmentsDirectory() // equal to fileAttachmentsDirectory on RichEditor
    ->richtextGetUploadedAttachmentUrlUsing() // equal to getUploadedAttachmentUrlUsing on RichEditor
    ->richtextSaveUploadedFileAttachmentsUsing(); // equal to saveUploadedFileAttachmentsUsing on RichEditor

// For text input only
TranslatedText::make('text-input')
    ->tel()
    ->telRegex()
    ->email()
    ->url()
    ->numeric()
    ->integer()
    ->step();

// For both
TranslatedText::make('text')
    ->regex()
    ->minLength()
    ->maxLength();
```

---------

Co-authored-by: Glenn Jacobs <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unconfirmed
Projects
None yet
Development

No branches or pull requests

1 participant