preview doc on chat solved

This commit is contained in:
Equilibrium ITO
2024-03-18 11:13:34 +01:00
parent a52ff2aef8
commit c08531a630
3861 changed files with 1962946 additions and 270 deletions
@@ -900,7 +900,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
fileBase64 = await this._getBase64(file)
formData = new FormData();
formData.append('blobFile', blob);
formData.append('blobFile', file);
}
this.ChatSystemService.getGroupRoom(roomId).send({
@@ -1120,10 +1120,10 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
});
modal.present();
} else {
this.downloadFileFromBrowser("file", str)
this.downloadFileFromBrowser(msg.attachments[0].title, msg.attachments[0].attachmentsUrl)
}
} else {
this.openFile(str, msg.attachments[0].title, msg.file.type);
this.openFile(msg.attachments.image_url, msg.attachments[0].title, msg.file.type);
}
}
@@ -861,7 +861,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
file.type == 'application/xls' || file.type == 'application/xlsx' || file.type == 'application/ppt' ||
file.type == 'application/pptx' || file.type == 'application/txt') {
console.log('FILE', file)
console.log('FILE rigth?', file)
const fileName = file.name
@@ -886,12 +886,13 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
/* console.log('add file', fileBase64) */
} else {
console.log('encode data' ,encodedData)
blob = this.fileService.base64toBlob(encodedData, file.type)
fileBase64 = await this._getBase64(file)
formData = new FormData();
formData.append('blobFile', blob);
formData.append('blobFile', file);
}
@@ -1093,8 +1094,10 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
downloadFileFromBrowser(fileName: string, data: any): void {
const linkSource = data;
console.log('data in', data)
const downloadLink = document.createElement("a");
downloadLink.href = linkSource;
console.log('downloadLink.href',downloadLink.href)
downloadLink.download = fileName;
downloadLink.click();
}
@@ -1164,12 +1167,12 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
});
modal.present();
} else {
this.downloadFileFromBrowser("file", str)
this.downloadFileFromBrowser(msg.attachments[0].title, msg.attachments[0].attachmentsUrl,)
}
} else {
this.openFile(str, msg.attachments[0].title, msg.file.type);
this.openFile(msg.attachments[0].image_url, msg.attachments[0].title, msg.file.type);
// this.downloadFileFromBrowser("file", str)
}