summaryrefslogtreecommitdiffstats
path: root/client/components/main/editor.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/main/editor.js')
-rwxr-xr-xclient/components/main/editor.js50
1 files changed, 24 insertions, 26 deletions
diff --git a/client/components/main/editor.js b/client/components/main/editor.js
index 0c2e3186..abe4160f 100755
--- a/client/components/main/editor.js
+++ b/client/components/main/editor.js
@@ -152,33 +152,31 @@ Template.editor.onRendered(() => {
const processData = function(fileObj) {
Utils.processUploadedAttachment(
currentCard,
- fileObj,
- attachment => {
- if (
- attachment &&
- attachment._id &&
- attachment.isImage()
- ) {
- attachment.one('uploaded', function() {
- const maxTry = 3;
- const checkItvl = 500;
- let retry = 0;
- const checkUrl = function() {
- // even though uploaded event fired, attachment.url() is still null somehow //TODO
- const url = attachment.url();
- if (url) {
- insertImage(
- `${location.protocol}//${location.host}${url}`,
- );
- } else {
- retry++;
- if (retry < maxTry) {
- setTimeout(checkUrl, checkItvl);
+ fileObj,
+ { onUploaded:
+ attachment => {
+ if (attachment && attachment._id && attachment.isImage) {
+ attachment.one('uploaded', function() {
+ const maxTry = 3;
+ const checkItvl = 500;
+ let retry = 0;
+ const checkUrl = function() {
+ // even though uploaded event fired, attachment.url() is still null somehow //TODO
+ const url = Attachments.link(attachment, 'original', '/');
+ if (url) {
+ insertImage(
+ `${location.protocol}//${location.host}${url}`,
+ );
+ } else {
+ retry++;
+ if (retry < maxTry) {
+ setTimeout(checkUrl, checkItvl);
+ }
}
- }
- };
- checkUrl();
- });
+ };
+ checkUrl();
+ });
+ }
}
},
);