@props([
'label' => 'Details',
'rows' => 10,
'placeholder' => 'Write your message...',
])
@php
$wireModel = $attributes->wire('model');
$model = $wireModel->value();
$initialValue = $model ? data_get($this, $model, '') : '';
@endphp
whereDoesntStartWith('wire:model')->merge(['class' => 'space-y-2']) }}
x-data="{
model: @js($model),
value: @js($initialValue),
sync() {
this.value = this.$refs.editor.innerHTML;
if (this.model) {
this.$wire.set(this.model, this.value, false);
}
},
command(action, value = null) {
this.$refs.editor.focus();
document.execCommand(action, false, value);
this.sync();
},
init() {
this.$refs.editor.innerHTML = this.value || '';
}
}"
>
@if($model)
@error($model)
{{ $message }}
@enderror
@endif