robsontenorio / mary

Laravel Blade UI Components for Livewire 3
https://mary-ui.com
Other
1.04k stars 125 forks source link

rich text editor does not show property value #564

Closed lucas-davi closed 2 months ago

lucas-davi commented 2 months ago

maryUI version

1.35.4

daisyUI version

4.12.10

Livewire version

3.5.4

What browsers are affected?

Chrome

What happened?

value is not shown in rich text editor, this code is just an example

I'm also using modal

create a new component Editor

class Editor extends Component
{
    public bool $modal = false;

    public string $text = '';

    public function render(): View
    {
        return view('livewire.editor');
    }

    #[On('show-modal')]
    public function open(): void
    {
        $this->text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';

        $this->modal = true;
    }
}

in the view editor

<div>
    <x-mary-modal wire:model="modal" class="backdrop-blur">
        <div class="mb-5">{{ $text }}</div>

        <div class="divider"></div>

        <x-mary-editor wire:model="text" label="Description" />

        <x-mary-button label="Cancel" @click="$wire.modal = false" class="mt-6" />
    </x-mary-modal>
</div>

the button to open the modal is present in another component

<x-mary-button wire:click="$dispatchTo('editor', 'show-modal')">
    Open
</x-mary-button>

result

image

does not display any error in the console.

sorry my bad english.

thanks for the help 😊

lucas-davi commented 2 months ago

complement

updating mary component editor

from:

<input id="{{ $uuid }}" x-ref="tinymce" type="textarea" {{ $attributes->whereDoesntStartWith('wire:model') }} />

to:

<input x-ref="tinymce" type="textarea" {{ $attributes->whereDoesntStartWith('wire:model') }} />

works for me

robsontenorio commented 2 months ago

I reproduced the bug.

But, that is weird , your suggestion does work for me.

robsontenorio commented 2 months ago

Could you try the main branch? There is a fix merged.

composer require robsontenorio/mary:dev-main
php artisan view:clear
lucas-davi commented 2 months ago

worked perfectly, thanks for the support.