summaryrefslogtreecommitdiffstats
path: root/client/lib
diff options
context:
space:
mode:
authorSam X. Chen <sam.xi.chen@gmail.com>2019-08-10 21:21:42 -0400
committerSam X. Chen <sam.xi.chen@gmail.com>2019-08-10 21:21:42 -0400
commit67d23ff8ae691397ae9a5c12699397e01e34408e (patch)
tree2019baaa53fb21415408e1584a43f4353a1b2639 /client/lib
parent77b5244723db4602077c362843833b539c6a88fd (diff)
downloadwekan-67d23ff8ae691397ae9a5c12699397e01e34408e.tar.gz
wekan-67d23ff8ae691397ae9a5c12699397e01e34408e.tar.bz2
wekan-67d23ff8ae691397ae9a5c12699397e01e34408e.zip
Add Feature: Richer Editor insert picture as attachment instead of b64 string
Diffstat (limited to 'client/lib')
-rw-r--r--client/lib/utils.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/client/lib/utils.js b/client/lib/utils.js
index f81e691c..81835929 100644
--- a/client/lib/utils.js
+++ b/client/lib/utils.js
@@ -26,6 +26,31 @@ 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);
+ }
+ };
+ if (!card) {
+ return next();
+ }
+ const file = new FS.File(fileObj);
+ if (card.isLinkedCard()) {
+ file.boardId = Cards.findOne(card.linkedId).boardId;
+ file.cardId = card.linkedId;
+ } else {
+ file.boardId = card.boardId;
+ file.swimlaneId = card.swimlaneId;
+ file.listId = card.listId;
+ file.cardId = card._id;
+ }
+ file.userId = Meteor.userId();
+ if (file.original) {
+ file.original.name = fileObj.name;
+ }
+ return next(Attachments.insert(file));
+ },
shrinkImage(options) {
// shrink image to certain size
const dataurl = options.dataurl,