Initial commit
This commit is contained in:
39
app/Http/Livewire/QuillEditor.php
Normal file
39
app/Http/Livewire/QuillEditor.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use App\Rules\MaxLengthWithoutHtml;
|
||||
use Livewire\Attributes\Rule;
|
||||
use Livewire\Component;
|
||||
|
||||
class QuillEditor extends Component
|
||||
{
|
||||
public $content;
|
||||
|
||||
public function mount($content)
|
||||
{
|
||||
$this->content = $content;
|
||||
}
|
||||
|
||||
|
||||
public function updatedContent()
|
||||
{
|
||||
$maxLength = timebank_config('posts.content_max_input', 1000);
|
||||
|
||||
$this->validateOnly('content', [
|
||||
'content' => ['required', 'string', 'min:10', new MaxLengthWithoutHtml($maxLength)]
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function updated()
|
||||
{
|
||||
$this->dispatch('quillEditor', $this->content);
|
||||
}
|
||||
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.quill-editor');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user