add placeholder for uploading images

This commit is contained in:
Jakobus Schürz 2025-01-10 18:53:43 +01:00
parent d0ccd5d263
commit 29cb0211db

View file

@ -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);