]> git.mxchange.org Git - friendica.git/commitdiff
fix editing in modal-jot
authorJakobus Schürz <jakobus.schuerz@schuerz.at>
Tue, 14 Mar 2023 12:55:47 +0000 (13:55 +0100)
committerJakobus Schürz <jakobus.schuerz@schuerz.at>
Sun, 19 Mar 2023 17:52:45 +0000 (18:52 +0100)
and add also timeout before removing images from dropzone

view/theme/frio/js/modal.js
view/theme/frio/templates/jot.tpl

index 876fe90a829ec502d134b657d89f8dd8d31ade4c..a20862e7517f31a3b0062b2dcfe07b8f91cf2226 100644 (file)
@@ -293,7 +293,7 @@ function editpost(url) {
 
                        // To make dropzone fileupload work on editing a comment, we need to
                        // 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
                                maxFilesize: getMBytes('{{$max_imagesize}}'), // MB
                                url: "/media/photo/upload?response=url&album=",
@@ -317,13 +317,15 @@ function editpost(url) {
                                                // 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
-                                               this.removeFile(file);
+                                               setTimeout(function(){
+                                                       dropzoneJotEdit.removeFile(file);
+                                               },5000);
                                        });
                                },
                        });
 
                        // 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;
                                items.forEach((item) => {
                                        if (item.kind === 'file') {
index 7ad44ff9ab71b7d8fa1a924007136383499ddfee..1ffe7dd3c173132719997aa08a28e142a53bf354 100644 (file)
                                        {{/if}}
 
                                        {{* The jot text field in which the post text is inserted *}}
-                                       <div id="dropzone-jot" class="dropzone">
-                                               <div id="jot-text-wrap">
+                                       <!--div id="dropzone-jot" class="dropzone"-->
+                                               <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>
                                                </div>
-                                       </div>
+                                       <!--/div-->
 
                                        <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>
@@ -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
        // to workaround dysfunctional php Strings:getBytesFromShorthand
        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
                maxFilesize: getMBytes('{{$max_imagesize}}'), // MB
                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
                                // We need preview to get optical feedback about upload-progress.
                                // 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
-       $('#dropzone-jot').on('paste', function(event){
+       $('#jot-text-wrap').on('paste', function(event){
                const items = (event.clipboardData || event.originalEvent.clipboardData).items;
                items.forEach((item) => {
                        if (item.kind === 'file') {