fix editing in modal-jot

and add also timeout before removing images from dropzone
This commit is contained in:
Jakobus Schürz 2023-03-14 13:55:47 +01:00
parent 64066349aa
commit 721c065a44
2 changed files with 13 additions and 9 deletions

View File

@ -293,7 +293,7 @@ function editpost(url) {
// To make dropzone fileupload work on editing a comment, we need to // To make dropzone fileupload work on editing a comment, we need to
// attach a new dropzone to modal // attach a new dropzone to modal
dropzoneJotEdit = new Dropzone( '#dropzone-jot', { dropzoneJotEdit = new Dropzone( '#jot-text-wrap', {
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: getMBytes('{{$max_imagesize}}'), // MB maxFilesize: getMBytes('{{$max_imagesize}}'), // MB
url: "/media/photo/upload?response=url&album=", url: "/media/photo/upload?response=url&album=",
@ -317,13 +317,15 @@ function editpost(url) {
// 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.
// you see success, when the bb-code link for image is inserted // you see success, when the bb-code link for image is inserted
this.removeFile(file); setTimeout(function(){
dropzoneJotEdit.removeFile(file);
},5000);
}); });
}, },
}); });
// Enables Copy&Paste for this dropzone // Enables Copy&Paste for this dropzone
$('#dropzone-jot').on('paste', function(event){ $('#jot-text-wrap').on('paste', function(event){
const items = (event.clipboardData || event.originalEvent.clipboardData).items; const items = (event.clipboardData || event.originalEvent.clipboardData).items;
items.forEach((item) => { items.forEach((item) => {
if (item.kind === 'file') { if (item.kind === 'file') {

View File

@ -99,11 +99,11 @@
{{/if}} {{/if}}
{{* The jot text field in which the post text is inserted *}} {{* The jot text field in which the post text is inserted *}}
<div id="dropzone-jot" class="dropzone"> <!--div id="dropzone-jot" class="dropzone"-->
<div id="jot-text-wrap"> <div id="jot-text-wrap" class="dropzone">
<textarea rows="2" cols="64" class="profile-jot-text form-control text-autosize" id="profile-jot-text" name="body" placeholder="{{$share}}" onFocus="jotTextOpenUI(this);" onBlur="jotTextCloseUI(this);" style="min-width:100%; max-width:100%;" dir="auto">{{if $content}}{{$content nofilter}}{{/if}}</textarea> <textarea rows="2" cols="64" class="profile-jot-text form-control text-autosize" id="profile-jot-text" name="body" placeholder="{{$share}}" onFocus="jotTextOpenUI(this);" onBlur="jotTextCloseUI(this);" style="min-width:100%; max-width:100%;" dir="auto">{{if $content}}{{$content nofilter}}{{/if}}</textarea>
</div> </div>
</div> <!--/div-->
<ul id="profile-jot-submit-wrapper" class="jothidden nav nav-pills"> <ul id="profile-jot-submit-wrapper" class="jothidden nav nav-pills">
<li role="presentation"><button type="button" class="hidden-xs btn-link icon underline" style="cursor: pointer;" aria-label="{{$eduline}}" title="{{$eduline}}" onclick="insertFormattingToPost('u');"><i class="fa fa-underline"></i></button></li> <li role="presentation"><button type="button" class="hidden-xs btn-link icon underline" style="cursor: pointer;" aria-label="{{$eduline}}" title="{{$eduline}}" onclick="insertFormattingToPost('u');"><i class="fa fa-underline"></i></button></li>
@ -185,7 +185,7 @@ can load different content into the jot modal (e.g. the item edit jot)
// getMByte() is from view/theme/frio/js/dropzone-frio.js // getMByte() is from view/theme/frio/js/dropzone-frio.js
// to workaround dysfunctional php Strings:getBytesFromShorthand // to workaround dysfunctional php Strings:getBytesFromShorthand
Dropzone.autoDiscover = false; Dropzone.autoDiscover = false;
var dropzoneJot = new Dropzone( '#dropzone-jot', { var dropzoneJot = new Dropzone( '#jot-text-wrap', {
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: getMBytes('{{$max_imagesize}}'), // MB maxFilesize: getMBytes('{{$max_imagesize}}'), // MB
url: "/media/photo/upload?response=url&album=", url: "/media/photo/upload?response=url&album=",
@ -209,13 +209,15 @@ can load different content into the jot modal (e.g. the item edit jot)
// 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.
// you see success, when the bb-code link for image is inserted // you see success, when the bb-code link for image is inserted
this.removeFile(file); setTimeout(function(){
dropzoneJot.removeFile(file);
},5000);
}); });
}, },
}); });
// Enables Copy&Paste for this dropzone // Enables Copy&Paste for this dropzone
$('#dropzone-jot').on('paste', function(event){ $('#jot-text-wrap').on('paste', function(event){
const items = (event.clipboardData || event.originalEvent.clipboardData).items; const items = (event.clipboardData || event.originalEvent.clipboardData).items;
items.forEach((item) => { items.forEach((item) => {
if (item.kind === 'file') { if (item.kind === 'file') {