Add mobile detection - open PDFs in new tab on screens < 768px
This commit is contained in:
parent
7d792fe635
commit
9ad058339a
1 changed files with 13 additions and 4 deletions
|
|
@ -42,10 +42,19 @@ const toggleEntry = (id: number) => {
|
||||||
const openDocument = (doc: Document, event: MouseEvent) => {
|
const openDocument = (doc: Document, event: MouseEvent) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
selectedDocument.value = {
|
|
||||||
title: doc.title,
|
const documentUrl = `/api/documents/${doc.id}/download`;
|
||||||
url: `/api/documents/${doc.id}/download`
|
|
||||||
};
|
// On mobile (< 768px), open PDF directly in new tab
|
||||||
|
// On desktop, use modal viewer
|
||||||
|
if (window.innerWidth < 768) {
|
||||||
|
window.open(documentUrl, '_blank');
|
||||||
|
} else {
|
||||||
|
selectedDocument.value = {
|
||||||
|
title: doc.title,
|
||||||
|
url: documentUrl
|
||||||
|
};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeViewer = () => {
|
const closeViewer = () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue