From 2234db4ad0bc028154064ad5eace66c3c1bd459b Mon Sep 17 00:00:00 2001 From: Patrick Bitzer Date: Mon, 1 Jun 2026 12:40:43 +0200 Subject: [PATCH] fix: insert asset filename on WYSIWYG drop without selection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dropping a non-image asset (e.g. PDF, DOCX) into a Quill WYSIWYG without a prior text selection produced no visible output. The onDropWysiwyg handler called quill.format('link', uri) only, which per Quill's API sets a "next character" format on an empty selection but does not insert any text — leaving the editor unchanged. The follow-up getLeaf() lookup then never found an , so pimcore_id and pimcore_type were also missing. When no text is selected, insert the asset filename (data.text with a path-derived fallback) as plain text and select it; the existing link-formatting and pimcore_id / pimcore_type attribute logic then applies as it does for the selected-text case. The image-drop path and the document/object branches are untouched. --- public/js/editor.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/js/editor.js b/public/js/editor.js index 4e33b11..97af3ed 100644 --- a/public/js/editor.js +++ b/public/js/editor.js @@ -226,6 +226,12 @@ pimcore.bundle.quill.editor = Class.create({ return true; } else { + if (!textIsSelected) { + const filename = data.text || (data.path || '').split('/').pop() || 'Datei'; + this.activeEditor.insertText(retval.index, filename, 'user'); + this.activeEditor.setSelection(retval.index, filename.length); + retval = this.activeEditor.getSelection(); + } this.activeEditor.format('link', uri); const [leaf, offset] = this.activeEditor.getLeaf(retval.index + 1); if (leaf && leaf.parent.domNode.nodeName === 'A') {