Pārlūkot izejas kodu

correcif regression dropzone preview

Valentin CARRUESCO 5 gadi atpakaļ
vecāks
revīzija
533c8ed43b
1 mainītis faili ar 2 papildinājumiem un 2 dzēšanām
  1. 2 2
      js/main.js

+ 2 - 2
js/main.js

@@ -642,7 +642,7 @@ function init_components(selector){
 				if(input.find('form').length != 0 || input.find('ul>li').length) break;
 				if(!input.attr('data-action')) input.attr('data-action','action.php?action=upload_temporary_file');
 				var readonly = input.attr('data-readonly') == "true" ? true : false;
-
+				if(!input.get(0).hasAttribute('id')) input.attr('id',generate_uuid(10));
 				var customTpl = input.find('> *:not(:visible)');
 				var customActions = '';
 				if(customTpl && customTpl.length){
@@ -653,7 +653,7 @@ function init_components(selector){
 					});
 				}
 				var preview = '<li data-path="{{path}}">';
-			    preview += input.attr('data-preview')=="true" ? '<img style="margin: 0 5px;float: left;max-height:100px;max-width:80px;" src="{{url}}"/>' : '<i class="fa {{icon}}"></i>';
+			    preview += input.get(0).hasAttribute('data-preview') ? '<img style="margin: 0 5px;float: left;max-height:100px;max-width:80px;" src="{{url}}"/>' : '<i class="fa {{icon}}"></i>';
 				preview += ' <a {{#url}}href="{{url}}"{{/url}} target="_blank" title="{{name}}">{{name}}{{lastModification}}</a> '+customActions+' <i class="fas fa-times pointer '+(input.attr('data-delete')?'':'hidden')+'" onclick="{{#temporary}}dropzone_delete_file(this);{{/temporary}}{{^temporary}}'+input.attr('data-delete')+'(this){{/temporary}}"></i><div class="clear"></div></li>';
 
 				var valueFiles = input.html()!='' && is_json_string(input.text()) ? JSON.parse(input.text()) : [];