[Notice] Announcing the End of Demo Server [Read me]
attachment: Fix drag and drop bug when to edit comment
@129304337feeedff77293b4b0ddd91d8324b35c2
--- public/javascripts/common/yona.CommentAttachmentsUpdate.js
+++ public/javascripts/common/yona.CommentAttachmentsUpdate.js
... | ... | @@ -75,11 +75,16 @@ |
75 | 75 |
var $attachfiles = $parentForm.find(".temporaryUploadFiles"); |
76 | 76 |
var $textarea = $parentForm.find("textarea"); |
77 | 77 |
|
78 |
- if (doneCount === 0) { |
|
78 |
+ |
|
79 |
+ if ($attachfiles.val() === "") { |
|
79 | 80 |
$attachfiles.val(data.id); |
80 | 81 |
} else { |
81 |
- $attachfiles.val($attachfiles.val() + "," + data.id); |
|
82 |
+ var splitted = $attachfiles.val().split(","); |
|
83 |
+ if(!splitted.includes(data.id)) { |
|
84 |
+ $attachfiles.val(splitted.concat(data.id).join(",")); |
|
85 |
+ } |
|
82 | 86 |
} |
87 |
+ |
|
83 | 88 |
var attachment = '<div class="attached-file attached-file-marker" data-mime="' + |
84 | 89 |
data.mimeType.trim() + '" data-name="' + data.name + '" data-href="' + data.url + '">\n' + |
85 | 90 |
'<strong class="name">' + data.name + '</strong>\n' + |
... | ... | @@ -119,8 +124,6 @@ |
119 | 124 |
|
120 | 125 |
var dt = e.originalEvent.dataTransfer; |
121 | 126 |
var files = dt.files; |
122 |
- |
|
123 |
- console.log(files); |
|
124 | 127 |
|
125 | 128 |
$(this).css("border", rememberBorder); |
126 | 129 |
$(this).parent().closest("form").find(".file-upload__input")[0].files = files; |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?