debugging ticket creation, lost spell checker

This commit is contained in:
Mark Gregory
2026-06-24 08:43:38 +01:00
parent d9b472e651
commit 28ee25fd12
3 changed files with 61 additions and 15 deletions
@@ -14,29 +14,49 @@
<div {{ $attributes->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()" x-data="{
x-on:helpdesk-editor-sync.window="if ($event.detail.model === model) sync(false)" x-data="{
model: @js($model),
value: @js($initialValue),
sync() {
submitHandler: null,
sync(live = false) {
this.value = this.$refs.editor.innerHTML;
if (this.model) {
this.$wire.set(this.model, this.value);
this.$wire.set(this.model, this.value, live);
}
},
command(action, value = null) {
this.$refs.editor.focus();
document.execCommand(action, false, value);
this.sync();
this.sync(false);
},
clear() {
this.value = '';
this.$refs.editor.innerHTML = '';
if (this.model) {
this.$wire.set(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 });
}
}
}">
<label class="block text-sm font-medium text-zinc-700 dark:text-zinc-200">{{ $label }}</label>
@@ -66,9 +86,9 @@
class="rounded-lg px-2 py-1 text-sm hover:bg-zinc-200 dark:hover:bg-zinc-800">Clear</button>
</div>
<div x-ref="editor" contenteditable="true" spellcheck="true" lang="en-GB" autocapitalize="sentences" autocorrect="on" autocomplete="on" inputmode="text"
<div x-ref="editor" contenteditable="true" spellcheck="true" lang="en-GB" autocapitalize="off" autocorrect="off" autocomplete="off" inputmode="text"
@if ($editorDusk) data-dusk="{{ $editorDusk }}" dusk="{{ $editorDusk }}" @endif
x-on:input.debounce.150ms="sync" x-on:keyup="sync" x-on:paste="$nextTick(() => sync())" x-on:blur="sync"
x-on:input.debounce.250ms="sync(false)" x-on:paste="$nextTick(() => sync(false))" x-on:blur="sync(false)"
class="prose prose-sm min-h-[{{ (int) $rows * 28 }}px] max-w-none bg-white p-4 text-sm text-zinc-900 outline-none dark:prose-invert dark:bg-zinc-950 dark:text-zinc-100"
data-placeholder="{{ $placeholder }}"></div>
</div>