From 129304337feeedff77293b4b0ddd91d8324b35c2 Mon Sep 17 00:00:00 2001 From: Suwon Chae Date: Fri, 26 Oct 2018 23:18:26 +0900 Subject: [PATCH] attachment: Fix drag and drop bug when to edit comment --- .../common/yona.CommentAttachmentsUpdate.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/public/javascripts/common/yona.CommentAttachmentsUpdate.js b/public/javascripts/common/yona.CommentAttachmentsUpdate.js index 326053210..64228106b 100644 --- a/public/javascripts/common/yona.CommentAttachmentsUpdate.js +++ b/public/javascripts/common/yona.CommentAttachmentsUpdate.js @@ -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 = '
\n' + '' + data.name + '\n' + @@ -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; })