@props([ 'label' => 'Details', 'rows' => 10, 'placeholder' => 'Write your message...', 'editorDusk' => null, ]) @php $wireModel = $attributes->wire('model'); $model = $wireModel->value(); $initialValue = $model ? data_get($this, $model, '') : ''; @endphp
whereDoesntStartWith('wire:model')->merge(['class' => 'space-y-2']) }} @if ($model) data-helpdesk-editor-model="{{ $model }}" @endif x-on:helpdesk-editor-reset.window="if ($event.detail.model === model) clear()" x-on:helpdesk-editor-sync.window="if ($event.detail.model === model) syncToLivewire()" x-data="{ model: @js($model), value: @js($initialValue), submitHandler: null, readEditor() { this.value = this.$refs.editor.innerHTML; return this.value; }, syncToHiddenInput() { this.readEditor(); }, syncToLivewire(live = false) { this.readEditor(); if (this.model) { this.$wire.set(this.model, this.value, live); } }, command(action, value = null) { this.$refs.editor.focus(); document.execCommand(action, false, value); this.syncToHiddenInput(); }, clear() { this.value = ''; this.$refs.editor.innerHTML = ''; if (this.model) { this.$wire.set(this.model, '', false); } }, init() { this.$refs.editor.innerHTML = this.value || ''; this.submitHandler = () => this.syncToLivewire(false); this.$root.closest('form')?.addEventListener('submit', this.submitHandler, { capture: true }); }, destroy() { if (this.submitHandler) { this.$root.closest('form')?.removeEventListener('submit', this.submitHandler, { capture: true }); } } }"> @if ($model) @endif

Browser spellcheck is enabled for this rich editor. Misspelled words are checked by the browser/operating system while typing.

@if ($model) @error($model)
{{ $message }}
@enderror @endif