new ataxchments preview code
This commit is contained in:
@@ -39,6 +39,21 @@
|
||||
document.execCommand(action, false, value);
|
||||
this.syncToHiddenInput();
|
||||
},
|
||||
insertCodeBlock() {
|
||||
this.$refs.editor.focus();
|
||||
document.execCommand('formatBlock', false, 'pre');
|
||||
this.syncToHiddenInput();
|
||||
},
|
||||
handlePaste(event) {
|
||||
const files = Array.from(event.clipboardData?.files || []);
|
||||
const images = files.filter((file) => file.type.startsWith('image/'));
|
||||
|
||||
if (images.length > 0) {
|
||||
window.dispatchEvent(new CustomEvent('helpdesk-editor-files-pasted', { detail: { files: images } }));
|
||||
}
|
||||
|
||||
this.$nextTick(() => this.syncToHiddenInput());
|
||||
},
|
||||
clear() {
|
||||
this.value = '';
|
||||
this.$refs.editor.innerHTML = '';
|
||||
@@ -80,6 +95,8 @@
|
||||
class="rounded-lg px-2 py-1 text-sm hover:bg-zinc-200 dark:hover:bg-zinc-800">1. List</button>
|
||||
<button type="button" x-on:click="command('formatBlock', 'blockquote')"
|
||||
class="rounded-lg px-2 py-1 text-sm hover:bg-zinc-200 dark:hover:bg-zinc-800">Quote</button>
|
||||
<button type="button" x-on:click="insertCodeBlock()"
|
||||
class="rounded-lg px-2 py-1 text-sm font-mono hover:bg-zinc-200 dark:hover:bg-zinc-800">Code</button>
|
||||
<button type="button" x-on:click="const url = prompt('URL'); if (url) command('createLink', url)"
|
||||
class="rounded-lg px-2 py-1 text-sm hover:bg-zinc-200 dark:hover:bg-zinc-800">Link</button>
|
||||
<button type="button" x-on:click="command('removeFormat')"
|
||||
@@ -88,13 +105,13 @@
|
||||
|
||||
<div x-ref="editor" contenteditable="true" spellcheck="true" lang="en-GB" autocapitalize="sentences" autocorrect="on" autocomplete="off" inputmode="text"
|
||||
@if ($editorDusk) data-dusk="{{ $editorDusk }}" dusk="{{ $editorDusk }}" @endif
|
||||
x-on:paste="$nextTick(() => syncToHiddenInput())" x-on:blur="syncToHiddenInput()"
|
||||
x-on:paste="handlePaste($event)" x-on:blur="syncToHiddenInput()"
|
||||
class="helpdesk-rich-editor 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>
|
||||
|
||||
<p class="text-xs font-semibold text-zinc-500 dark:text-zinc-400">
|
||||
Browser spellcheck is enabled for this rich editor. Misspelled words are checked by the browser/operating system while typing.
|
||||
Browser spellcheck is enabled. Use Code for snippets, and paste screenshots directly into the editor to attach them to the ticket.
|
||||
</p>
|
||||
|
||||
@if ($model)
|
||||
|
||||
Reference in New Issue
Block a user