# Progress

## Completed Features

### PDF Embed Gutenberg Block ✅
Full implementation of a `/pdf` block that lets editors embed WPFD PDF files using PDF.js.

**Components:**
- `app/admin/assets/blocks/pdf/block.json` — block registration (name: `wpfd/wpfd-pdf`)
- `app/admin/assets/blocks/pdf/wpfd-pdf.jsx` — edit/save Gutenberg component
- `app/site/templates/pdf-embed.php` — standalone PDF.js viewer iframe template
- `app/site/assets/js/pdf-embed/` — PDF.js library (pdf.js, pdf.worker.js, pdf.sandbox.js, viewer.js)
- `app/site/assets/css/pdf-embed/` — PDF.js CSS (viewer.css, images/, locale/)
- `app/site/assets/css/wpfd-pdf-embed.css` — parent-page iframe wrapper CSS
- `app/site/helpers/WpfdHelperShortcodes.php::pdfEmbedShortcode()` — shortcode renderer
- `app/site/init.php::wpfd_pdf_embed_stream()` — AJAX PDF binary stream handler

**Shortcode:** `[wpfdpdf id="X" catid="Y" name="Title" embed="1" target="" width="100%" height="800"]`

**Status:** All fixes applied, JS rebuilt (130 kB). Ready for manual QA.

### Bug Fixes (session 2)
1. `wpfd-pdf.jsx` — catid now uses `categorySelectedId` state (not `file.term_id`)
2. `pdf-embed.php` — added `html,body { height:100% }` + PHP-injected fallback URL for viewer
3. `init.php` — stream handler now handles remote/cloud files via redirect

---

## Known Issues / Limitations
- Cloud PDF files redirect to their OAuth URL (may expire for Google Drive / OneDrive)
- `wpfd_pdf_embed_stream` is publicly accessible (nopriv) — no per-file access control yet

## Core Plugin Features (pre-existing, all working)
- File management, category management
- Download tracking, expiry, access control
- Multiple cloud integrations (Google Drive, OneDrive, Dropbox, AWS, Nextcloud)
- Gutenberg blocks: category, single file, search
- Shortcodes: `wpfd_category`, `wpfd_single_file`, `wpfd_files`, `wpfd_search`
- Email notifications, statistics, watermarking
