Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove PDF in new tab feature #437

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 3 additions & 19 deletions frontend/src/components/messages/RequestConversations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<span class="font-weight-bold">Sent:</span>
{{ format.formatDate(item.sentDate) }}
</div>
<div class="pt-1" @click.capture="handlePdf" v-html="item.message" />
<div class="pt-1" v-html="item.message" />
</v-col>
</v-row>
</template>
Expand Down Expand Up @@ -209,16 +209,6 @@ export default {
deriveFromDisplay(item) {
return item.ofmSourceSystem ? `${this.userInfo?.firstName ?? ''} ${this.userInfo?.lastName}` : OFM_PROGRAM
},
handlePdf(event) {
if (event.target.classList.contains('conversation-pdf')) {
fetch(event.target.dataset.link)
.then((res) => res.blob())
.then((blob) => {
const blobUrl = URL.createObjectURL(blob)
window.open(blobUrl)
})
}
},
async formatConversation() {
const parser = new DOMParser()
for (const conversation of this.assistanceRequestConversation) {
Expand Down Expand Up @@ -246,14 +236,8 @@ export default {
const file = await FileService.getFile(fileId)
const dataLink = `data:${file.mimetype};base64,${file.fileData}`

if (file.mimetype === 'application/pdf') {
fileLink.setAttribute('href', '#')
fileLink.classList.add('conversation-pdf')
fileLink.setAttribute('data-link', dataLink)
} else {
fileLink.setAttribute('href', dataLink)
fileLink.setAttribute('download', file.filename)
}
fileLink.setAttribute('href', dataLink)
fileLink.setAttribute('download', file.filename)
} else {
fileLink.remove()
}
Expand Down
Loading