File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 3535 return {
3636 file_name: item .file_name ,
3737 file_extension: item .file_extension ,
38- file_data: isExternalUrl (item .file_url ) ? item .file_url : ` ${ PUBLIC_SERVICE_URL }${ item .file_url } ?access_token=${ $userStore? .token }`
38+ file_data: isExternalUrl (item .file_url ) ? item .file_url : ` ${ PUBLIC_SERVICE_URL }${ item .file_url } ?access_token=${ $userStore? .token }` ,
39+ file_download_url: isExternalUrl(item.file_download_url) ? item.file_download_url : ` ${PUBLIC_SERVICE_URL }${item .file_download_url }? access_token= ${$userStore? .token }`
3940 };
4041 });
4142 // @ts-ignore
5051 });
5152 }
5253 });
54+
55+ /** @param {number} idx */
56+ function handleDownloadFile(idx) {
57+ const found = textFiles.find((_, index) => index === idx);
58+ if (found?.file_download_url) {
59+ window.open(found.file_download_url);
60+ }
61+ }
5362</script>
5463
5564
5867 containerStyles={galleryStyles}
5968 files={textFiles}
6069 showFileName
70+ needDownload
71+ onDownload={idx => handleDownloadFile(idx)}
6172/>
6273<AudioGallery
6374 id={messageId}
Original file line number Diff line number Diff line change 1212 * @property {string } file_name - The file name.
1313 * @property {string } [file_extension] - The file extension.
1414 * @property {string } file_data - The file data or url.
15+ * @property {string } [file_download_url] - The file download url.
1516 */
1617
1718/**
You can’t perform that action at this time.
0 commit comments