From d0ccd5d2633991cb56163680fef9b473e30be3ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Fri, 10 Jan 2025 09:40:09 +0100 Subject: [PATCH 1/9] remove unneeded newlines --- src/Module/Media/Photo/Upload.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/Media/Photo/Upload.php b/src/Module/Media/Photo/Upload.php index 2032c60143..66dc51e9f8 100644 --- a/src/Module/Media/Photo/Upload.php +++ b/src/Module/Media/Photo/Upload.php @@ -163,7 +163,7 @@ class Upload extends \Friendica\BaseModule } $this->logger->info('upload done'); - $this->return(200, "\n\n" . Images::getBBCodeByResource($resource_id, $owner['nickname'], $preview, $image->getExt()) . "\n\n"); + $this->return(200, Images::getBBCodeByResource($resource_id, $owner['nickname'], $preview, $image->getExt())); } /** 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 2/9] 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); From f55ed01fb52a566cf752b3255c570556085240a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Fri, 10 Jan 2025 23:26:15 +0100 Subject: [PATCH 3/9] enable dropzone on jot for mentions --- view/templates/item/compose.tpl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/view/templates/item/compose.tpl b/view/templates/item/compose.tpl index 4cccc924c3..4c7bdebfdb 100644 --- a/view/templates/item/compose.tpl +++ b/view/templates/item/compose.tpl @@ -92,6 +92,9 @@