diff options
author | Romulus Urakagi Tsai <urakagi@gmail.com> | 2019-12-24 08:57:34 +0000 |
---|---|---|
committer | Romulus Urakagi Tsai <urakagi@gmail.com> | 2019-12-24 08:57:34 +0000 |
commit | 93337c20f83146bb702a5af8cf9cdb37f4c53443 (patch) | |
tree | 8d40fe3b4fabd0bd2f813620f10ab56ba91f6816 /client/lib | |
parent | 6cdd464f54fca423876a27ec2a4269ae5841cdb0 (diff) | |
download | wekan-93337c20f83146bb702a5af8cf9cdb37f4c53443.tar.gz wekan-93337c20f83146bb702a5af8cf9cdb37f4c53443.tar.bz2 wekan-93337c20f83146bb702a5af8cf9cdb37f4c53443.zip |
Change upload routine, add upload popup
Diffstat (limited to 'client/lib')
-rw-r--r-- | client/lib/popup.js | 2 | ||||
-rw-r--r-- | client/lib/utils.js | 18 |
2 files changed, 12 insertions, 8 deletions
diff --git a/client/lib/popup.js b/client/lib/popup.js index 8095fbd2..cae22659 100644 --- a/client/lib/popup.js +++ b/client/lib/popup.js @@ -49,7 +49,7 @@ window.Popup = new (class { // has one. This allows us to position a sub-popup exactly at the same // position than its parent. let openerElement; - if (clickFromPopup(evt)) { + if (clickFromPopup(evt) && self._getTopStack()) { openerElement = self._getTopStack().openerElement; } else { self._stack = []; diff --git a/client/lib/utils.js b/client/lib/utils.js index 8503b035..213124f1 100644 --- a/client/lib/utils.js +++ b/client/lib/utils.js @@ -25,12 +25,7 @@ Utils = { }, MAX_IMAGE_PIXEL: Meteor.settings.public.MAX_IMAGE_PIXEL, COMPRESS_RATIO: Meteor.settings.public.IMAGE_COMPRESS_RATIO, - processUploadedAttachment(card, fileObj, callback) { - const next = attachment => { - if (typeof callback === 'function') { - callback(attachment); - } - }; + processUploadedAttachment(card, fileObj, callbacks) { if (!card) { return onUploaded(); } @@ -50,7 +45,16 @@ Utils = { settings.meta.cardId = card._id; } settings.meta.userId = Meteor.userId(); - Attachments.insert(settings).on('end', next); + if (typeof callbacks === 'function') { + settings.onEnd = callbacks; + } else { + for (const key in callbacks) { + if (key.substring(0, 2) === 'on') { + settings[key] = callbacks[key]; + } + } + } + Attachments.insert(settings); }, shrinkImage(options) { // shrink image to certain size |