mirror of
https://github.com/friendica/friendica
synced 2025-01-19 17:39:46 +00:00
add placeholder for uploading images
This commit is contained in:
parent
d0ccd5d263
commit
29cb0211db
1 changed files with 6 additions and 1 deletions
|
@ -23,6 +23,10 @@ var DzFactory = function (max_imagesize) {
|
||||||
dictRemoveFile: dzStrings.dictRemoveFile,
|
dictRemoveFile: dzStrings.dictRemoveFile,
|
||||||
dictMaxFilesExceeded: dzStrings.dictMaxFilesExceeded,
|
dictMaxFilesExceeded: dzStrings.dictMaxFilesExceeded,
|
||||||
accept: function(file, done) {
|
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();
|
done();
|
||||||
},
|
},
|
||||||
init: function() {
|
init: function() {
|
||||||
|
@ -30,7 +34,8 @@ var DzFactory = function (max_imagesize) {
|
||||||
const targetTextarea = document.getElementById(textareaElementId);
|
const targetTextarea = document.getElementById(textareaElementId);
|
||||||
if (targetTextarea.setRangeText) {
|
if (targetTextarea.setRangeText) {
|
||||||
//if setRangeText function is supported by current browser
|
//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 {
|
} else {
|
||||||
targetTextarea.focus();
|
targetTextarea.focus();
|
||||||
document.execCommand('insertText', false /*no UI*/, serverResponse);
|
document.execCommand('insertText', false /*no UI*/, serverResponse);
|
||||||
|
|
Loading…
Add table
Reference in a new issue