Description
Flux version
v2.1.6
Livewire version
v3.6.2
Tailwind version
v4.0.7
Browser and Operating System
Brave on Windows 11 LTSC Enterprise
What is the problem?
When I attempt to use a Flux UI Rich Text Editor
The editor initializes successfully, but the text field is empty. I can confirm that the database field has content within it. I can type in the field and hit save, and it will save as expected. However: Reloading the page will present me with a blank editor despite the column still containing the last data I saved.
I have tried other browsers with the same result. I've tried Brave with all addons disabled, and shields completely off. The JavaScript console returns no errors (or outputs for that matter).
One thing to note: I am using a custom Livewire initialize to load the sort
AlpineJS plugin. Code provided in code snippets below.
Code snippets
app/Livewire/Admin/Pages/Editor.php
<?php
namespace App\Livewire\Admin\Pages;
use App\Models\Page;
use Illuminate\Contracts\View\View;
use Livewire\Component;
class Editor extends Component
{
public Page $page;
public ?string $content;
public function mount(string $id): void
{
$this->page = Page::findOrFail($id);
$this->content = $this->page->content;
}
public function save(): void
{
$this->page->content = $this->content;
$this->page->save();
}
public function render(): View
{
return view('livewire.admin.pages.editor');
}
}
resources/views/livewire/admin/pages/editor.blade.php
<div>
<div class="flex justify-between items-center mb-6">
<div class="flex flex-col">
<flux:heading size="xl">Edit Page</flux:heading>
<flux:subheading class="font-semibold">{{ $page->title }}</flux:subheading>
</div>
<flux:button wire:click="save">Save</flux:button>
</div>
<div>
<flux:editor wire:model="content" label="Page contents" />
</div>
</div>
resources/js/app.js
import { Livewire, Alpine } from '../../vendor/livewire/livewire/dist/livewire.esm';
import sort from '@alpinejs/sort';
Alpine.plugin(sort);
Livewire.start();
How do you expect it to work?
I'd expect the editor to have the content as modeled through Livewire when the page loads.
Please confirm (incomplete submissions will not be addressed)
- I have provided easy and step-by-step instructions to reproduce the bug.
- I have provided code samples as text and NOT images.
- I understand my bug report will be closed if I haven't met the criteria above.