changes in case of code-review

This commit is contained in:
Jakobus Schürz 2023-03-17 10:49:12 +01:00
parent fba33d3afc
commit 6436d2cd8a
3 changed files with 10 additions and 11 deletions

View File

@ -408,7 +408,6 @@ class Conversation
'$compose_link_title' => $this->l10n->t('Open Compose page'), '$compose_link_title' => $this->l10n->t('Open Compose page'),
'$always_open_compose' => $this->pConfig->get($this->session->getLocalUserId(), 'frio', 'always_open_compose', false), '$always_open_compose' => $this->pConfig->get($this->session->getLocalUserId(), 'frio', 'always_open_compose', false),
]); ]);

View File

@ -1,6 +1,6 @@
var DzFactory = function () { var DzFactory = function () {
this.createDropzone = function(dropSelector, textareaSelector) { this.createDropzone = function(dropSelector, textareaElementId) {
return new Dropzone( dropSelector, { return new Dropzone(dropSelector, {
paramName: 'userfile', // The name that will be used to transfer the file paramName: 'userfile', // The name that will be used to transfer the file
maxFilesize: max_imagesize, // MB maxFilesize: max_imagesize, // MB
url: '/media/photo/upload?response=url&album=', url: '/media/photo/upload?response=url&album=',
@ -12,7 +12,7 @@ var DzFactory = function () {
}, },
init: function() { init: function() {
this.on('success', function(file, serverResponse) { this.on('success', function(file, serverResponse) {
const targetTextarea = document.getElementById(textareaSelector); const targetTextarea = document.getElementById(textareaElementId);
const bbcodeString = $(serverResponse).find('div#content').text(); const bbcodeString = $(serverResponse).find('div#content').text();
if (targetTextarea.setRangeText) { if (targetTextarea.setRangeText) {
//if setRangeText function is supported by current browser //if setRangeText function is supported by current browser
@ -23,7 +23,7 @@ var DzFactory = function () {
} }
}); });
this.on('complete', function(file) { this.on('complete', function(file) {
var dz = this; const dz = this;
// Remove just uploaded file from dropzone, makes interface more clear. // Remove just uploaded file from dropzone, makes interface more clear.
// Image can be seen in posting-preview // Image can be seen in posting-preview
// We need preview to get optical feedback about upload-progress. // We need preview to get optical feedback about upload-progress.
@ -55,8 +55,8 @@ var DzFactory = function () {
}) })
}; };
this.setupDropzone = function(dropSelector, textareaSelector) { this.setupDropzone = function(dropSelector, textareaElementId) {
var dropzone = this.createDropzone(dropSelector, textareaSelector); var dropzone = this.createDropzone(dropSelector, textareaElementId);
$(dropSelector).on('paste', function(event) { $(dropSelector).on('paste', function(event) {
dzFactory.copyPaste(event, dropzone); dzFactory.copyPaste(event, dropzone);
}) })

View File

@ -68,12 +68,12 @@
<script> <script>
$('[id=comment-fake-text-{{$id}}]').on('focus', function() { $('[id=comment-fake-text-{{$id}}]').on('focus', function() {
dzFactory.setupDropzone('#dropzone-{{$id}}', 'comment-edit-text-{{$id}}'); dzFactory.setupDropzone('#dropzone-{{$id}}', 'comment-edit-text-{{$id}}');
$('[id=comment-fake-text-{{$id}}]').prop('focus', null).off('focus') $('[id=comment-fake-text-{{$id}}]').prop('focus', null).off('focus');
$('[id=comment-{{$id}}]').prop('click', null).off('click') $('[id=comment-{{$id}}]').prop('click', null).off('click');
}); });
$('[id=comment-{{$id}}]').on('click', function() { $('[id=comment-{{$id}}]').on('click', function() {
dzFactory.setupDropzone('#dropzone-{{$id}}', 'comment-edit-text-{{$id}}'); dzFactory.setupDropzone('#dropzone-{{$id}}', 'comment-edit-text-{{$id}}');
$('[id=comment-fake-text-{{$id}}]').prop('focus', null).off('focus') $('[id=comment-fake-text-{{$id}}]').prop('focus', null).off('focus');
$('[id=comment-{{$id}}]').prop('click', null).off('click') $('[id=comment-{{$id}}]').prop('click', null).off('click');
}); });
</script> </script>