Skip to content

Commit

Permalink
attachment: Fix drag and drop bug when to edit comment
Browse files Browse the repository at this point in the history
  • Loading branch information
doortts committed Oct 26, 2018
1 parent 0c54435 commit 1293043
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions public/javascripts/common/yona.CommentAttachmentsUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,16 @@ $(function(){
var $attachfiles = $parentForm.find(".temporaryUploadFiles");
var $textarea = $parentForm.find("textarea");

if (doneCount === 0) {

if ($attachfiles.val() === "") {
$attachfiles.val(data.id);
} else {
$attachfiles.val($attachfiles.val() + "," + data.id);
var splitted = $attachfiles.val().split(",");
if(!splitted.includes(data.id)) {
$attachfiles.val(splitted.concat(data.id).join(","));
}
}

var attachment = '<div class="attached-file attached-file-marker" data-mime="' +
data.mimeType.trim() + '" data-name="' + data.name + '" data-href="' + data.url + '">\n' +
'<strong class="name">' + data.name + '</strong>\n' +
Expand Down Expand Up @@ -120,8 +125,6 @@ $(function(){
var dt = e.originalEvent.dataTransfer;
var files = dt.files;

console.log(files);

$(this).css("border", rememberBorder);
$(this).parent().closest("form").find(".file-upload__input")[0].files = files;
})
Expand Down

0 comments on commit 1293043

Please sign in to comment.