From 29cb0211dbb109932ae03e2c0392b3d89f5964ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Fri, 10 Jan 2025 18:53:43 +0100 Subject: [PATCH] add placeholder for uploading images --- view/js/dropzone-factory.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/view/js/dropzone-factory.js b/view/js/dropzone-factory.js index bdb2353f1d..73e2c4300a 100644 --- a/view/js/dropzone-factory.js +++ b/view/js/dropzone-factory.js @@ -23,6 +23,10 @@ var DzFactory = function (max_imagesize) { dictRemoveFile: dzStrings.dictRemoveFile, dictMaxFilesExceeded: dzStrings.dictMaxFilesExceeded, accept: function(file, done) { + const targetTextarea = document.getElementById(textareaElementId); + if (targetTextarea.setRangeText) { + targetTextarea.setRangeText("\n[upload-"+file.name+"]\n",targetTextarea.selectionStart,targetTextarea.selectionEnd,"end"); + } done(); }, init: function() { @@ -30,7 +34,8 @@ var DzFactory = function (max_imagesize) { const targetTextarea = document.getElementById(textareaElementId); if (targetTextarea.setRangeText) { //if setRangeText function is supported by current browser - targetTextarea.setRangeText(serverResponse); + let u = "[upload-"+file.name+"]"; + targetTextarea.setRangeText(serverResponse, targetTextarea.value.indexOf(u), targetTextarea.value.indexOf(u)+u.length, "end"); } else { targetTextarea.focus(); document.execCommand('insertText', false /*no UI*/, serverResponse);