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

change wire:ignore #1827

Merged
merged 1 commit into from
Mar 8, 2022
Merged

change wire:ignore #1827

merged 1 commit into from
Mar 8, 2022

Conversation

atmonshi
Copy link
Contributor

@atmonshi atmonshi commented Mar 8, 2022

allow rich-editor component to be reactive by changing the wire:ignore position.

@ryangjchandler
Copy link
Member

@atmonshi Is this so you can dynamically change the toolbar buttons, etc?

@atmonshi
Copy link
Contributor Author

atmonshi commented Mar 8, 2022

yes, if I have two RichEditor considering the code:

Forms\Components\Radio::make('type')
    ->reactive()
    ->options([
        'sms' => 'SMS',
        'email' => 'EMAIL',
    ]),

Forms\Components\RichEditor::make('content')->toolbarButtons(['link'])
    ->visible(fn (Closure $get) => $get('type') === 'sms'),

Forms\Components\RichEditor::make('content')->toolbarButtons(['bold'])
    ->visible(fn (Closure $get) => $get('type') === 'email'),

or only one with conditional toolbarButtons

RichEditor::make('content')
                    ->disableAllToolbarButtons()
                    ->toolbarButtons(function (Closure $get) {
                        if ($get('type') === 'sms')
                        {
                            return ['link'];
                        }
                          return ['attachFiles'];

                    })
                    ->reactive(),

this will fix both scenarios.

@danharrin danharrin added bug Something isn't working labels Mar 8, 2022
@danharrin
Copy link
Member

Thank you

@danharrin danharrin merged commit 27a368a into filamentphp:2.x Mar 8, 2022
@atmonshi atmonshi deleted the fix-trix-editor branch March 8, 2022 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants