@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) sync(false)" x-data="{ model: @js($model), value: @js($initialValue), submitHandler: null, sync(live = false) { this.value = this.$refs.editor.innerHTML; 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.sync(false); }, 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.sync(false); this.$nextTick(() => { const form = this.$root.closest('form'); if (form) { form.addEventListener('submit', this.submitHandler, { capture: true }); } }); }, destroy() { const form = this.$root.closest('form'); if (form && this.submitHandler) { form.removeEventListener('submit', this.submitHandler, { capture: true }); } } }"> @if ($model) @endif

Browser spellcheck is enabled for this rich editor. Use your browser or operating-system spelling menu for suggestions.

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