Pārlūkot izejas kodu

Update - auto update card cover with new image uploaded via drag&drop

Thuan Pham Quoc 7 gadi atpakaļ
vecāks
revīzija
c3e67510c8
1 mainītis faili ar 6 papildinājumiem un 1 dzēšanām
  1. 6 1
      client/components/cards/attachments.js

+ 6 - 1
client/components/cards/attachments.js

@@ -113,7 +113,12 @@ Template.previewClipboardImagePopup.events({
       file.boardId = card.boardId;
       file.cardId = card._id;
       file.userId = Meteor.userId();
-      Attachments.insert(file);
+      const attachment = Attachments.insert(file);
+
+      if (attachment && attachment._id && attachment.isImage()) {
+        card.setCover(attachment._id);
+      }
+
       pastedResults = null;
       $(document.body).pasteImageReader(() => {});
       Popup.close();