From 29d7b4ef243a838592c80bba6c7c577494131a3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Mon, 13 Mar 2023 03:32:28 +0100 Subject: [PATCH 01/36] fix path for js and css loading --- src/Content/Conversation.php | 1 + src/Core/ACL.php | 2 + src/Module/Item/Compose.php | 2 +- view/templates/item/compose.tpl | 50 +++++++++++++++++++++- view/theme/frio/templates/comment_item.tpl | 48 ++++++++++++++++++++- view/theme/frio/templates/head.tpl | 3 ++ view/theme/frio/templates/jot.tpl | 48 ++++++++++++++++++++- 7 files changed, 148 insertions(+), 6 deletions(-) diff --git a/src/Content/Conversation.php b/src/Content/Conversation.php index 249190b1a..7cf207627 100644 --- a/src/Content/Conversation.php +++ b/src/Content/Conversation.php @@ -445,6 +445,7 @@ class Conversation $this->page->registerFooterScript(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.js')); $this->page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css')); $this->page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput-typeahead.css')); + $this->page->registerStylesheet(Theme::getPathForFile('vendor/enyo/dropzone/dist/min/dropzone.min.css')); $live_update_div = ''; diff --git a/src/Core/ACL.php b/src/Core/ACL.php index 4ed8d602a..45f8e1128 100644 --- a/src/Core/ACL.php +++ b/src/Core/ACL.php @@ -59,8 +59,10 @@ class ACL $page->registerFooterScript(Theme::getPathForFile('asset/typeahead.js/dist/typeahead.bundle.js')); $page->registerFooterScript(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.js')); + $page->registerFooterScript(Theme::getPathForFile('../vendor/enyo/dropzone/dist/min/dropzone.min.js')); $page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css')); $page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput-typeahead.css')); + $page->registerStylesheet(Theme::getPathForFile('../vendor/enyo/dropzone/dist/min/dropzone.min.css')); $contacts = self::getValidMessageRecipientsForUser(DI::userSession()->getLocalUserId()); diff --git a/src/Module/Item/Compose.php b/src/Module/Item/Compose.php index d44fe2cd7..1bb56a3f7 100644 --- a/src/Module/Item/Compose.php +++ b/src/Module/Item/Compose.php @@ -164,7 +164,7 @@ class Compose extends BaseModule $this->page->registerFooterScript(Theme::getPathForFile('js/ajaxupload.js')); $this->page->registerFooterScript(Theme::getPathForFile('js/linkPreview.js')); $this->page->registerFooterScript(Theme::getPathForFile('js/compose.js')); - + $this->page->registerFooterScript(Theme::getPathForFile('../vendor/enyo/dropzone/dist/min/dropzone.min.js')); $contact = Contact::getById($a->getContactId()); if ($this->pConfig->get(DI::userSession()->getLocalUserId(), 'system', 'set_creation_date')) { diff --git a/view/templates/item/compose.tpl b/view/templates/item/compose.tpl index 50e21b149..1143a5efb 100644 --- a/view/templates/item/compose.tpl +++ b/view/templates/item/compose.tpl @@ -1,10 +1,17 @@ -
+

{{$l10n.compose_title}}

{{if $l10n.always_open_compose}}

{{$l10n.always_open_compose nofilter}}

{{/if}}
-
+ + + {{**}} @@ -71,6 +78,7 @@ +

@@ -94,3 +102,41 @@
+ diff --git a/view/theme/frio/templates/comment_item.tpl b/view/theme/frio/templates/comment_item.tpl index 7bce14ee1..ee09b36f3 100644 --- a/view/theme/frio/templates/comment_item.tpl +++ b/view/theme/frio/templates/comment_item.tpl @@ -1,8 +1,8 @@ {{if $threaded}} -
+
{{else}} -
+
{{/if}}
@@ -61,6 +61,50 @@
+
+ diff --git a/view/theme/frio/templates/head.tpl b/view/theme/frio/templates/head.tpl index 7851dacbd..b506ad278 100644 --- a/view/theme/frio/templates/head.tpl +++ b/view/theme/frio/templates/head.tpl @@ -55,6 +55,8 @@ media="screen" /> + {{foreach $stylesheets as $stylesheetUrl => $media}} @@ -137,6 +139,7 @@ {{/if}} + {{* Include the strings which are needed for some js functions (e.g. translation) They are loaded into the html so that js functions can use them *}} diff --git a/view/theme/frio/templates/jot.tpl b/view/theme/frio/templates/jot.tpl index c38e8531c..285b8e8d7 100644 --- a/view/theme/frio/templates/jot.tpl +++ b/view/theme/frio/templates/jot.tpl @@ -70,7 +70,7 @@
- diff --git a/view/theme/frio/js/modal.js b/view/theme/frio/js/modal.js index 705f472c4..85c258c92 100644 --- a/view/theme/frio/js/modal.js +++ b/view/theme/frio/js/modal.js @@ -293,48 +293,8 @@ function editpost(url) { // To make dropzone fileupload work on editing a comment, we need to // attach a new dropzone to modal - dropzoneJotEdit = new Dropzone( '#jot-text-wrap', { - paramName: 'userfile', // The name that will be used to transfer the file - maxFilesize: '{{$max_imagesize}}', // MB - url: '/media/photo/upload?response=url&album=', - accept: function(file, done) { - done(); - }, - init: function() { - this.on('success', function(file, serverResponse) { - var target = $('#profile-jot-text') - var resp = $(serverResponse).find('div#content').text() - if (target.setRangeText) { - //if setRangeText function is supported by current browser - target.setRangeText(' ' + $.trim(resp) + ' ') - } else { - target.focus() - document.execCommand('insertText', false /*no UI*/, ' ' + $.trim(resp) + ' '); - } - }); - this.on('complete', function(file) { - // Remove just uploaded file from dropzone, makes interface more clear. - // Image can be seen in posting-preview - // We need preview to get optical feedback about upload-progress. - // you see success, when the bb-code link for image is inserted - setTimeout(function(){ - dropzoneJotEdit.removeFile(file); - },5000); - }); - }, - }); - - // Enables Copy&Paste for this dropzone - $('#jot-text-wrap').on('paste', function(event){ - const items = (event.clipboardData || event.originalEvent.clipboardData).items; - items.forEach((item) => { - if (item.kind === 'file') { - // adds the file to your dropzone instance - dropzoneJotEdit.addFile(item.getAsFile()) - } - }) - }) - + console.log("modal.js max_imagesize",'{{$max_imagesize}}'); + dzFactory.setupDropzone('#jot-text-wrap', 'profile-jot-text', '{{$max_imagesize}}'); modal.show(); $("#jot-popup").show(); diff --git a/view/theme/frio/templates/comment_item.tpl b/view/theme/frio/templates/comment_item.tpl index b61c1d6f8..3d9860a10 100644 --- a/view/theme/frio/templates/comment_item.tpl +++ b/view/theme/frio/templates/comment_item.tpl @@ -67,13 +67,13 @@ diff --git a/view/theme/frio/templates/jot.tpl b/view/theme/frio/templates/jot.tpl index 1b77ded42..325c8d5b3 100644 --- a/view/theme/frio/templates/jot.tpl +++ b/view/theme/frio/templates/jot.tpl @@ -180,5 +180,5 @@ can load different content into the jot modal (e.g. the item edit jot) From 920dcca263edb51088381b7077ff336222e10bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Wed, 15 Mar 2023 21:48:17 +0100 Subject: [PATCH 27/36] render max_imagesize in header.tpl so it is reachable general from the whole website, and the dropzone-factory can use it also to create dropzones from modal.js --- mod/photos.php | 6 ------ src/App/Page.php | 14 ++++++++----- src/Content/Conversation.php | 3 --- src/Module/Item/Compose.php | 3 --- src/Module/Post/Edit.php | 2 -- src/Object/Post.php | 2 -- view/js/dropzone-factory.js | 8 ++++---- view/templates/item/compose.tpl | 2 +- view/theme/frio/js/dropzone-frio.js | 24 ---------------------- view/theme/frio/js/modal.js | 3 +-- view/theme/frio/templates/comment_item.tpl | 4 ++-- view/theme/frio/templates/head.tpl | 2 +- view/theme/frio/templates/jot.tpl | 2 +- 13 files changed, 19 insertions(+), 56 deletions(-) delete mode 100644 view/theme/frio/js/dropzone-frio.js diff --git a/mod/photos.php b/mod/photos.php index 5b225489e..a08b569ce 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1139,8 +1139,6 @@ function photos_content(App $a) '$loading' => DI::l10n()->t('Loading...'), '$qcomment' => $qcomment, '$rand_num' => Crypto::randomDigits(12), - // Dropzone - '$max_imagesize' => round(\Friendica\Util\Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')) / 1000000, 1), ]); } } @@ -1196,8 +1194,6 @@ function photos_content(App $a) '$preview' => DI::l10n()->t('Preview'), '$qcomment' => $qcomment, '$rand_num' => Crypto::randomDigits(12), - // Dropzone - '$max_imagesize' => round(Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')) / 1000000, 1), ]); } @@ -1272,8 +1268,6 @@ function photos_content(App $a) '$preview' => DI::l10n()->t('Preview'), '$qcomment' => $qcomment, '$rand_num' => Crypto::randomDigits(12), - // Dropzone - '$max_imagesize' => round(Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')) / 1000000, 1), ]); } } diff --git a/src/App/Page.php b/src/App/Page.php index 965c04915..45ec6be0f 100644 --- a/src/App/Page.php +++ b/src/App/Page.php @@ -253,11 +253,15 @@ class Page implements ArrayAccess '$touch_icon' => $touch_icon, '$block_public' => intval($config->get('system', 'block_public')), '$stylesheets' => $this->stylesheets, - '$likeError' => $l10n->t('Like not successfull'), - '$dislikeError' => $l10n->t('Dislike not successfull'), - '$announceError' => $l10n->t('Sharing not successfull'), - '$srvError' => $l10n->t('Backend error'), - '$netError' => $l10n->t('Network error'), + '$likeError' => $l10n->t('Like not successfull'), + '$dislikeError' => $l10n->t('Dislike not successfull'), + '$announceError' => $l10n->t('Sharing not successfull'), + '$srvError' => $l10n->t('Backend error'), + '$netError' => $l10n->t('Network error'), + // Dropzone + '$max_imagesize' => round(\Friendica\Util\Strings::getBytesFromShorthand($config->get('system', 'maximagesize')) / 1000000, 1), + + ]) . $this->page['htmlhead']; } diff --git a/src/Content/Conversation.php b/src/Content/Conversation.php index 1d7430e19..f23333911 100644 --- a/src/Content/Conversation.php +++ b/src/Content/Conversation.php @@ -409,9 +409,6 @@ class Conversation '$compose_link_title' => $this->l10n->t('Open Compose page'), '$always_open_compose' => $this->pConfig->get($this->session->getLocalUserId(), 'frio', 'always_open_compose', false), - // Dropzone - '$max_imagesize' => round(\Friendica\Util\Strings::getBytesFromShorthand($this->config->get('system', 'maximagesize')) / 1000000, 1), - ]); diff --git a/src/Module/Item/Compose.php b/src/Module/Item/Compose.php index 19726eb71..f53158b1f 100644 --- a/src/Module/Item/Compose.php +++ b/src/Module/Item/Compose.php @@ -240,9 +240,6 @@ class Compose extends BaseModule 'deny_cid' => $contact_deny_list, 'deny_gid' => $group_deny_list, ]), - - // Dropzone - '$max_imagesize' => round(\Friendica\Util\Strings::getBytesFromShorthand($this->config->get('system', 'maximagesize')) / 1000000, 1), ]); } } diff --git a/src/Module/Post/Edit.php b/src/Module/Post/Edit.php index 403908cc0..5ddc250d8 100644 --- a/src/Module/Post/Edit.php +++ b/src/Module/Post/Edit.php @@ -185,8 +185,6 @@ class Edit extends BaseModule '$compose_link_title' => $this->t('Open Compose page'), - // Dropzone - '$max_imagesize' => round(Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')) / 1000000,1), ]); return $output; } diff --git a/src/Object/Post.php b/src/Object/Post.php index c6ef5e3ba..3f4d061a1 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -1069,8 +1069,6 @@ class Post '$preview' => DI::l10n()->t('Preview'), '$indent' => $indent, '$rand_num' => Crypto::randomDigits(12), - // Dropzone - '$max_imagesize' => round(\Friendica\Util\Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')) / 1000000,1), ]); } diff --git a/view/js/dropzone-factory.js b/view/js/dropzone-factory.js index 5aaab5036..bbf92625d 100644 --- a/view/js/dropzone-factory.js +++ b/view/js/dropzone-factory.js @@ -1,8 +1,8 @@ var DzFactory = function () { - this.createDropzone = function(dropSelector, textareaSelector, maxImagesize) { + this.createDropzone = function(dropSelector, textareaSelector) { return new Dropzone( dropSelector, { paramName: 'userfile', // The name that will be used to transfer the file - maxFilesize: maxImagesize, // MB + maxFilesize: max_imagesize, // MB url: '/media/photo/upload?response=url&album=', accept: function(file, done) { done(); @@ -52,8 +52,8 @@ var DzFactory = function () { }) }; - this.setupDropzone = function(dropSelector, textareaSelector, maxImagesize) { - var dropzone = this.createDropzone(dropSelector, textareaSelector, maxImagesize); + this.setupDropzone = function(dropSelector, textareaSelector) { + var dropzone = this.createDropzone(dropSelector, textareaSelector); $(dropSelector).on('paste', function(event) { dzFactory.copyPaste(event, dropzone); }) diff --git a/view/templates/item/compose.tpl b/view/templates/item/compose.tpl index 499dfaffb..09e42c90e 100644 --- a/view/templates/item/compose.tpl +++ b/view/templates/item/compose.tpl @@ -96,5 +96,5 @@
diff --git a/view/theme/frio/js/dropzone-frio.js b/view/theme/frio/js/dropzone-frio.js deleted file mode 100644 index c165633c4..000000000 --- a/view/theme/frio/js/dropzone-frio.js +++ /dev/null @@ -1,24 +0,0 @@ -function isInteger(value) { - return /^\d+$/.test(value); -} - -function getMBytes(value) { - var res; - if (isInteger(value)) { - res = value; - } else { - eh = value.slice(-1); - am = Number(value.slice(0, -1)); - switch (eh) { - case 'k': - res = am * 1024; - break; - case 'm': - res = am * 1024 * 1024; - break; - case 'g': - res = am * 1024 * 1024 * 1024; - } - } - return res / 1000000; -} diff --git a/view/theme/frio/js/modal.js b/view/theme/frio/js/modal.js index 85c258c92..905e78743 100644 --- a/view/theme/frio/js/modal.js +++ b/view/theme/frio/js/modal.js @@ -293,8 +293,7 @@ function editpost(url) { // To make dropzone fileupload work on editing a comment, we need to // attach a new dropzone to modal - console.log("modal.js max_imagesize",'{{$max_imagesize}}'); - dzFactory.setupDropzone('#jot-text-wrap', 'profile-jot-text', '{{$max_imagesize}}'); + dzFactory.setupDropzone('#jot-text-wrap', 'profile-jot-text'); modal.show(); $("#jot-popup").show(); diff --git a/view/theme/frio/templates/comment_item.tpl b/view/theme/frio/templates/comment_item.tpl index 3d9860a10..81664cf0f 100644 --- a/view/theme/frio/templates/comment_item.tpl +++ b/view/theme/frio/templates/comment_item.tpl @@ -67,12 +67,12 @@ - + {{* Include the strings which are needed for some js functions (e.g. translation) They are loaded into the html so that js functions can use them *}} diff --git a/view/theme/frio/templates/jot.tpl b/view/theme/frio/templates/jot.tpl index 325c8d5b3..5c18afa86 100644 --- a/view/theme/frio/templates/jot.tpl +++ b/view/theme/frio/templates/jot.tpl @@ -180,5 +180,5 @@ can load different content into the jot modal (e.g. the item edit jot) From c01f7f98ae88fd86331070ca24b6d640bbe90bca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Thu, 16 Mar 2023 12:03:49 +0100 Subject: [PATCH 28/36] reinsert Friendica\DI (accidentially removed before) --- mod/photos.php | 1 + 1 file changed, 1 insertion(+) diff --git a/mod/photos.php b/mod/photos.php index a08b569ce..18db9c15d 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -32,6 +32,7 @@ use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Database\DBStructure; +use Friendica\DI; use Friendica\Model\Contact; use Friendica\Model\Item; use Friendica\Model\Photo; From fba33d3afc5cff66094f162cd5c29e59a034126f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Thu, 16 Mar 2023 12:04:15 +0100 Subject: [PATCH 29/36] add options allowedFiles and more --- view/js/dropzone-factory.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/view/js/dropzone-factory.js b/view/js/dropzone-factory.js index bbf92625d..a3a3e6c36 100644 --- a/view/js/dropzone-factory.js +++ b/view/js/dropzone-factory.js @@ -4,6 +4,9 @@ var DzFactory = function () { paramName: 'userfile', // The name that will be used to transfer the file maxFilesize: max_imagesize, // MB url: '/media/photo/upload?response=url&album=', + addRemoveLinks: true, + acceptedFiles: 'image/*', + clickable: true, accept: function(file, done) { done(); }, From 6436d2cd8ac17198704129208d1f0e499f1cd83c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Fri, 17 Mar 2023 10:49:12 +0100 Subject: [PATCH 30/36] changes in case of code-review --- src/Content/Conversation.php | 1 - view/js/dropzone-factory.js | 12 ++++++------ view/theme/frio/templates/comment_item.tpl | 8 ++++---- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Content/Conversation.php b/src/Content/Conversation.php index f23333911..249190b1a 100644 --- a/src/Content/Conversation.php +++ b/src/Content/Conversation.php @@ -408,7 +408,6 @@ class Conversation '$compose_link_title' => $this->l10n->t('Open Compose page'), '$always_open_compose' => $this->pConfig->get($this->session->getLocalUserId(), 'frio', 'always_open_compose', false), - ]); diff --git a/view/js/dropzone-factory.js b/view/js/dropzone-factory.js index a3a3e6c36..21ea5ebbc 100644 --- a/view/js/dropzone-factory.js +++ b/view/js/dropzone-factory.js @@ -1,6 +1,6 @@ var DzFactory = function () { - this.createDropzone = function(dropSelector, textareaSelector) { - return new Dropzone( dropSelector, { + this.createDropzone = function(dropSelector, textareaElementId) { + return new Dropzone(dropSelector, { paramName: 'userfile', // The name that will be used to transfer the file maxFilesize: max_imagesize, // MB url: '/media/photo/upload?response=url&album=', @@ -12,7 +12,7 @@ var DzFactory = function () { }, init: function() { this.on('success', function(file, serverResponse) { - const targetTextarea = document.getElementById(textareaSelector); + const targetTextarea = document.getElementById(textareaElementId); const bbcodeString = $(serverResponse).find('div#content').text(); if (targetTextarea.setRangeText) { //if setRangeText function is supported by current browser @@ -23,7 +23,7 @@ var DzFactory = function () { } }); this.on('complete', function(file) { - var dz = this; + const dz = this; // Remove just uploaded file from dropzone, makes interface more clear. // Image can be seen in posting-preview // We need preview to get optical feedback about upload-progress. @@ -55,8 +55,8 @@ var DzFactory = function () { }) }; - this.setupDropzone = function(dropSelector, textareaSelector) { - var dropzone = this.createDropzone(dropSelector, textareaSelector); + this.setupDropzone = function(dropSelector, textareaElementId) { + var dropzone = this.createDropzone(dropSelector, textareaElementId); $(dropSelector).on('paste', function(event) { dzFactory.copyPaste(event, dropzone); }) diff --git a/view/theme/frio/templates/comment_item.tpl b/view/theme/frio/templates/comment_item.tpl index 81664cf0f..2d977d807 100644 --- a/view/theme/frio/templates/comment_item.tpl +++ b/view/theme/frio/templates/comment_item.tpl @@ -68,12 +68,12 @@ From 8a3361dfbe041983e5547dfe774f8ca91dd7d8c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Fri, 17 Mar 2023 10:54:31 +0100 Subject: [PATCH 31/36] remove upload-url parameter --- view/js/dropzone-factory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/js/dropzone-factory.js b/view/js/dropzone-factory.js index 21ea5ebbc..a5010b95e 100644 --- a/view/js/dropzone-factory.js +++ b/view/js/dropzone-factory.js @@ -3,7 +3,7 @@ var DzFactory = function () { return new Dropzone(dropSelector, { paramName: 'userfile', // The name that will be used to transfer the file maxFilesize: max_imagesize, // MB - url: '/media/photo/upload?response=url&album=', + url: '/media/photo/upload?album=', addRemoveLinks: true, acceptedFiles: 'image/*', clickable: true, From 399ee74e05da635df548df4911f2cd904fe2e3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Fri, 17 Mar 2023 13:06:42 +0100 Subject: [PATCH 32/36] revert to original (no changes needed anymore) --- src/Module/Item/Compose.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Module/Item/Compose.php b/src/Module/Item/Compose.php index f53158b1f..d44fe2cd7 100644 --- a/src/Module/Item/Compose.php +++ b/src/Module/Item/Compose.php @@ -164,6 +164,7 @@ class Compose extends BaseModule $this->page->registerFooterScript(Theme::getPathForFile('js/ajaxupload.js')); $this->page->registerFooterScript(Theme::getPathForFile('js/linkPreview.js')); $this->page->registerFooterScript(Theme::getPathForFile('js/compose.js')); + $contact = Contact::getById($a->getContactId()); if ($this->pConfig->get(DI::userSession()->getLocalUserId(), 'system', 'set_creation_date')) { From faa524faecdf5a8920fea9d169e60dfea32fb735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Fri, 17 Mar 2023 14:22:32 +0100 Subject: [PATCH 33/36] revert changes, remove line (from code-review) --- src/App/Page.php | 1 - src/Module/Post/Edit.php | 4 +--- src/Object/Post.php | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/App/Page.php b/src/App/Page.php index 45ec6be0f..23f542f7d 100644 --- a/src/App/Page.php +++ b/src/App/Page.php @@ -261,7 +261,6 @@ class Page implements ArrayAccess // Dropzone '$max_imagesize' => round(\Friendica\Util\Strings::getBytesFromShorthand($config->get('system', 'maximagesize')) / 1000000, 1), - ]) . $this->page['htmlhead']; } diff --git a/src/Module/Post/Edit.php b/src/Module/Post/Edit.php index 5ddc250d8..5fb339e17 100644 --- a/src/Module/Post/Edit.php +++ b/src/Module/Post/Edit.php @@ -28,7 +28,6 @@ use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Renderer; use Friendica\Core\Session\Capability\IHandleUserSessions; -use Friendica\DI; use Friendica\Model\Contact; use Friendica\Model\Post; use Friendica\Model\User; @@ -36,7 +35,6 @@ use Friendica\Module\Response; use Friendica\Navigation\SystemMessages; use Friendica\Network\HTTPException; use Friendica\Util\Crypto; -use Friendica\Util\Strings; use Friendica\Util\Profiler; use Psr\Log\LoggerInterface; @@ -184,8 +182,8 @@ class Edit extends BaseModule '$shortpermset' => $this->t('Permissions'), '$compose_link_title' => $this->t('Open Compose page'), - ]); + return $output; } diff --git a/src/Object/Post.php b/src/Object/Post.php index 3f4d061a1..17c0c1f68 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -1068,7 +1068,7 @@ class Post '$prompttext' => DI::l10n()->t('Please enter a image/video/audio/webpage URL:'), '$preview' => DI::l10n()->t('Preview'), '$indent' => $indent, - '$rand_num' => Crypto::randomDigits(12), + '$rand_num' => Crypto::randomDigits(12) ]); } From 57a7a3d6d803d0df59d17241e2d0bcce96abf275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Fri, 17 Mar 2023 15:17:55 +0100 Subject: [PATCH 34/36] change responsehandling to be ready for PR #12892 --- view/js/dropzone-factory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/js/dropzone-factory.js b/view/js/dropzone-factory.js index a5010b95e..1b2a29337 100644 --- a/view/js/dropzone-factory.js +++ b/view/js/dropzone-factory.js @@ -13,7 +13,7 @@ var DzFactory = function () { init: function() { this.on('success', function(file, serverResponse) { const targetTextarea = document.getElementById(textareaElementId); - const bbcodeString = $(serverResponse).find('div#content').text(); + const bbcodeString = serverResponse; if (targetTextarea.setRangeText) { //if setRangeText function is supported by current browser targetTextarea.setRangeText(' ' + $.trim(bbcodeString) + ' '); From 5040bd9a1a69d0956a67f15590a4acfeb29969f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Fri, 17 Mar 2023 17:05:18 +0100 Subject: [PATCH 35/36] change response-handling (code-review) --- view/js/dropzone-factory.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/view/js/dropzone-factory.js b/view/js/dropzone-factory.js index 1b2a29337..c2246dfa2 100644 --- a/view/js/dropzone-factory.js +++ b/view/js/dropzone-factory.js @@ -13,13 +13,12 @@ var DzFactory = function () { init: function() { this.on('success', function(file, serverResponse) { const targetTextarea = document.getElementById(textareaElementId); - const bbcodeString = serverResponse; if (targetTextarea.setRangeText) { //if setRangeText function is supported by current browser - targetTextarea.setRangeText(' ' + $.trim(bbcodeString) + ' '); + targetTextarea.setRangeText(' ' + $.trim(serverResponse) + ' '); } else { targetTextarea.focus(); - document.execCommand('insertText', false /*no UI*/, '\n' + $.trim(bbcodeString) + '\n'); + document.execCommand('insertText', false /*no UI*/, '\n' + $.trim(serverResponse) + '\n'); } }); this.on('complete', function(file) { From cf63cbde72e5fd41d237a3fe3aef3de4d07c9f1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Sun, 19 Mar 2023 19:14:10 +0100 Subject: [PATCH 36/36] remove removelink (it is not useful at the moment) --- view/js/dropzone-factory.js | 1 - 1 file changed, 1 deletion(-) diff --git a/view/js/dropzone-factory.js b/view/js/dropzone-factory.js index c2246dfa2..ca77bb6d5 100644 --- a/view/js/dropzone-factory.js +++ b/view/js/dropzone-factory.js @@ -4,7 +4,6 @@ var DzFactory = function () { paramName: 'userfile', // The name that will be used to transfer the file maxFilesize: max_imagesize, // MB url: '/media/photo/upload?album=', - addRemoveLinks: true, acceptedFiles: 'image/*', clickable: true, accept: function(file, done) {