mirror of
https://github.com/wekan/wekan.git
synced 2026-01-05 17:18:49 +01:00
Ref: original & and use fileObj.meta
fileObj.meta is part of the ostrio:files API and be passed to the constructor. This is less hacky than trying tu update a persistet object after the fact.
This commit is contained in:
parent
16506e7a6a
commit
e702f17c7b
10 changed files with 124 additions and 159 deletions
|
|
@ -67,19 +67,19 @@ Template.cardAttachmentsPopup.events({
|
|||
const uploader = Attachments.insert(
|
||||
{
|
||||
file: event.currentTarget.files[0],
|
||||
meta: Utils.getCommonAttachmentMetaFrom(card),
|
||||
chunkSize: 'dynamic',
|
||||
},
|
||||
false,
|
||||
);
|
||||
uploader.on('uploaded', (error, fileObj) => {
|
||||
uploader.on('uploaded', (error, fileRef) => {
|
||||
if (!error) {
|
||||
if (fileObj.isImage) {
|
||||
card.setCover(fileObj._id);
|
||||
if (fileRef.isImage) {
|
||||
card.setCover(fileRef._id);
|
||||
}
|
||||
Utils.addCommonMetaToAttachment(card, fileObj);
|
||||
}
|
||||
});
|
||||
uploader.on('end', (error, fileObj) => {
|
||||
uploader.on('end', (error, fileRef) => {
|
||||
Popup.back();
|
||||
});
|
||||
uploader.start();
|
||||
|
|
@ -131,28 +131,27 @@ Template.previewClipboardImagePopup.onRendered(() => {
|
|||
|
||||
Template.previewClipboardImagePopup.events({
|
||||
'click .js-upload-pasted-image'() {
|
||||
const results = pastedResults;
|
||||
if (results && results.file) {
|
||||
const card = this;
|
||||
if (pastedResults && pastedResults.file) {
|
||||
const file = pastedResults.file;
|
||||
window.oPasted = pastedResults;
|
||||
const card = this;
|
||||
const uploader = Attachments.insert(
|
||||
{
|
||||
file: results.file,
|
||||
fileName:
|
||||
results.name || results.file.type.replace('image/', 'clipboard.'),
|
||||
file,
|
||||
meta: Utils.getCommonAttachmentMetaFrom(card),
|
||||
fileName: file.name || file.type.replace('image/', 'clipboard.'),
|
||||
chunkSize: 'dynamic',
|
||||
},
|
||||
false,
|
||||
);
|
||||
uploader.on('uploaded', (error, fileObj) => {
|
||||
uploader.on('uploaded', (error, fileRef) => {
|
||||
if (!error) {
|
||||
if (fileObj.isImage) {
|
||||
card.setCover(fileObj._id);
|
||||
if (fileRef.isImage) {
|
||||
card.setCover(fileRef._id);
|
||||
}
|
||||
Utils.addCommonMetaToAttachment(card, fileObj);
|
||||
}
|
||||
});
|
||||
uploader.on('end', (error, fileObj) => {
|
||||
uploader.on('end', (error, fileRef) => {
|
||||
pastedResults = null;
|
||||
$(document.body).pasteImageReader(() => {});
|
||||
Popup.back();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue