From c71479d119f861b49cd2a1f3eff5ae525f942e0a Mon Sep 17 00:00:00 2001 From: Mark Gregory Date: Fri, 9 Oct 2026 14:04:47 +0100 Subject: [PATCH] added support for legacy tickets, fixed switching of modes and also style updates --- .../components/helpdesk/html-editor.blade.php | 29 +++++++++--------- .../helpdesk/livewire/ticket-create.blade.php | 30 ++++--------------- 2 files changed, 20 insertions(+), 39 deletions(-) mode change 100755 => 100644 resources/themes/backend/views/components/helpdesk/html-editor.blade.php mode change 100755 => 100644 resources/themes/backend/views/modules/helpdesk/livewire/ticket-create.blade.php diff --git a/resources/themes/backend/views/components/helpdesk/html-editor.blade.php b/resources/themes/backend/views/components/helpdesk/html-editor.blade.php old mode 100755 new mode 100644 index d1d6f76..70cafc9 --- a/resources/themes/backend/views/components/helpdesk/html-editor.blade.php +++ b/resources/themes/backend/views/components/helpdesk/html-editor.blade.php @@ -10,10 +10,11 @@ class="space-y-2" x-data="{ model: @js($model), - value: @entangle($model), + value: '', init() { this.$nextTick(() => { - this.writeEditorValue(this.value || ''); + this.value = this.$wire.get(this.model) || ''; + this.writeEditorValue(this.value); }); }, writeEditorValue(value) { @@ -30,29 +31,29 @@ this.$refs.editor.textContent = nextValue; }, - syncToLivewire(live = true) { - this.value = this.$refs.editor?.innerText || ''; - + syncToLivewire(live = false) { + const text = this.$refs.editor?.innerText || ''; + this.value = text; if (this.$refs.input) { - this.$refs.input.value = this.value; + this.$refs.input.value = text; } - - this.$wire.set(this.model, this.value, live); + // Update Livewire's local state before the save request is assembled. + this.$wire.set(this.model, text, live); }, resetEditor() { this.value = ''; this.writeEditorValue(''); - this.syncToLivewire(true); + this.syncToLivewire(false); }, runCommand(command) { this.$refs.editor?.focus(); document.execCommand(command, false, null); - this.syncToLivewire(true); + this.syncToLivewire(false); }, wrapBlock(tagName) { this.$refs.editor?.focus(); document.execCommand('formatBlock', false, tagName); - this.syncToLivewire(true); + this.syncToLivewire(false); }, }" x-on:helpdesk-editor-sync.window="if (! $event.detail?.model || $event.detail.model === @js($model)) syncToLivewire($event.detail?.live ?? true)" @@ -116,14 +117,14 @@ data-helpdesk-sync-target="{{ $model }}" data-helpdesk-editor-model="{{ $model }}" @if ($editorDusk) data-dusk="{{ $editorDusk }}" dusk="{{ $editorDusk }}" @endif - x-on:paste="syncToLivewire(false)" - x-on:blur="syncToLivewire(true)" + x-on:input="syncToLivewire(false)" + x-on:paste="$nextTick(() => syncToLivewire(false))" + x-on:blur="syncToLivewire(false)" class="helpdesk-rich-editor block min-h-[14rem] w-full overflow-y-auto whitespace-pre-wrap break-words border-0 bg-zinc-950 px-5 py-4 text-base leading-7 text-zinc-100 outline-none transition placeholder:text-zinc-500 empty:before:pointer-events-none empty:before:text-zinc-500 empty:before:content-[attr(data-placeholder)] focus:ring-2 focus:ring-blue-500" >