Add PDF file attachments to components

- Upload PDFs, rename them (conflict-checked), delete them
- Link/unlink files per component (many components can share a file)
- File picker dialog: browse existing files, rename inline, upload new
- Component detail shows linked files as clickable links
- Files stored in data/pdfs/, served at /pdf/:filename
- KV prefix: pdf:

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 00:19:30 +00:00
parent e91a656dc8
commit f0bedc80a7
6 changed files with 393 additions and 4 deletions

View File

@@ -147,6 +147,28 @@ export function delete_component_template(id) {
return store.delete(`ct:${id}`);
}
// --- PDF files ---
export function list_pdfs() {
const result = [];
for (const [key] of store.data.entries()) {
if (key.startsWith('pdf:')) result.push(store.get(key));
}
return result.sort((a, b) => a.display_name.localeCompare(b.display_name));
}
export function get_pdf(id) {
return store.get(`pdf:${id}`) ?? null;
}
export function set_pdf(pdf) {
store.set(`pdf:${pdf.id}`, pdf);
}
export function delete_pdf(id) {
return store.delete(`pdf:${id}`);
}
// --- Grid images ---
export function list_grid_images() {