1
0
Fork 0

fix getting bytes from shorthand in php

This commit is contained in:
Jakobus Schürz 2023-03-14 16:35:18 +01:00
commit 39f7660a1d
10 changed files with 36 additions and 56 deletions

View file

@ -96,29 +96,27 @@
</div>
</div>
<script>
// getMByte() is from view/theme/frio/js/dropzone-frio.js
// to workaround dysfunctional php Strings:getBytesFromShorthand
Dropzone.autoDiscover = false;
var dropzoneCompose = new Dropzone( '#dropzone-{{$id}}', {
paramName: "userfile", // The name that will be used to transfer the file
maxFilesize: getMBytes('{{$max_imagesize}}'), // MB
url: "/media/photo/upload?response=url&album=",
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) {
this.on('success', function(file, serverResponse) {
var target = $('#comment-edit-text-{{$id}}')
var resp = $(serverResponse).find('div#content').text()
if (target.setRangeText) {
//if setRangeText function is supported by current browser
target.setRangeText(" " + $.trim(resp) + " ")
target.setRangeText(' ' + $.trim(resp) + ' ')
} else {
target.focus()
document.execCommand('insertText', false /*no UI*/, $.trim(resp));
}
});
this.on("complete", function(file) {
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.