debugging ticket creation, lost spell checker
This commit is contained in:
@@ -14,49 +14,30 @@
|
||||
<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(false)" x-data="{
|
||||
x-on:helpdesk-editor-sync.window="if ($event.detail.model === model) sync()" x-data="{
|
||||
model: @js($model),
|
||||
value: @js($initialValue),
|
||||
submitHandler: null,
|
||||
sync(live = false) {
|
||||
sync() {
|
||||
this.value = this.$refs.editor.innerHTML;
|
||||
|
||||
if (this.model) {
|
||||
this.$wire.set(this.model, this.value, live);
|
||||
this.$wire.set(this.model, this.value, false);
|
||||
}
|
||||
},
|
||||
command(action, value = null) {
|
||||
this.$refs.editor.focus();
|
||||
document.execCommand(action, false, value);
|
||||
this.sync(false);
|
||||
this.sync();
|
||||
},
|
||||
clear() {
|
||||
this.value = '';
|
||||
this.$refs.editor.innerHTML = '';
|
||||
|
||||
if (this.model) {
|
||||
this.$wire.set(this.model, '', false);
|
||||
this.$wire.set(this.model, '');
|
||||
}
|
||||
},
|
||||
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>
|
||||
@@ -86,9 +67,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="off" autocorrect="off" autocomplete="off" inputmode="text"
|
||||
<div x-ref="editor" contenteditable="true" spellcheck="true" lang="en-GB" autocapitalize="sentences" autocorrect="on" autocomplete="on" inputmode="text"
|
||||
@if ($editorDusk) data-dusk="{{ $editorDusk }}" dusk="{{ $editorDusk }}" @endif
|
||||
x-on:input.debounce.250ms="sync(false)" x-on:paste="$nextTick(() => sync(false))" x-on:blur="sync(false)"
|
||||
x-on:paste="$nextTick(() => sync())" x-on:blur="sync"
|
||||
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>
|
||||
|
||||
Reference in New Issue
Block a user