feat(documents): migrate storage to filesystem, add server-side pagination
- Replace Base64 data URIs with file-based storage served via dedicated endpoints - Add DocumentPreviewModal navigation, DocumentThumbnail fileUrl support - Refactor documents page with server-side pagination, search, sort and filters - Update all components to use fileUrl/downloadUrl instead of raw path - Add pagination composable support (total, page, itemsPerPage, attachmentFilter) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,8 @@ type SiteDocument = {
|
||||
mimeType?: string
|
||||
size?: number
|
||||
path?: string
|
||||
fileUrl?: string
|
||||
downloadUrl?: string
|
||||
}
|
||||
|
||||
type SiteWithDocuments = {
|
||||
@@ -209,17 +211,23 @@ export function useSiteManagement() {
|
||||
}
|
||||
|
||||
const downloadDocument = (doc: SiteDocument) => {
|
||||
if (!doc?.path) return
|
||||
if (doc?.downloadUrl) {
|
||||
window.open(doc.downloadUrl, '_blank')
|
||||
return
|
||||
}
|
||||
|
||||
if (doc.path.startsWith('data:')) {
|
||||
const url = doc?.fileUrl || doc?.path
|
||||
if (!url) return
|
||||
|
||||
if (url.startsWith('data:')) {
|
||||
const link = document.createElement('a')
|
||||
link.href = doc.path
|
||||
link.href = url
|
||||
link.download = doc.filename || doc.name || 'document'
|
||||
link.click()
|
||||
return
|
||||
}
|
||||
|
||||
window.open(doc.path, '_blank')
|
||||
window.open(url, '_blank')
|
||||
}
|
||||
|
||||
const openPreview = (doc: SiteDocument) => {
|
||||
|
||||
Reference in New Issue
Block a user