Feat: pdfs - #1646
Feat: pdfs#1646b-d055 wants to merge 9 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
ad12f23 to
6dff9ee
Compare
6dff9ee to
1280f6e
Compare
1280f6e to
e3ef75c
Compare
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR adds first-class PDF support across the web app (renderable type, uploading/linking, previews, editor blocks, and diff rendering).
Changes:
- Introduces a new
PDFrenderable type, constants (PDF_TYPE,PDF_URL), and property mapping. - Adds PDF rendering/editing in entity pages, relation chips, and diff views.
- Adds a Tiptap
pdfnode + command item, server rendering, and a React-PDF based preview component.
Reviewed changes
Copilot reviewed 32 out of 33 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| bun.lock | Adds react-pdf and transitive deps to lockfile. |
| apps/web/package.json | Adds react-pdf dependency for PDF rendering. |
| apps/web/styles/styles.css | Adds .clamp-2 utility used by PDF preview UI. |
| apps/web/partials/import/import-generation.ts | Skips relation resolution for PDF URL columns during import. |
| apps/web/partials/entity-page/type-icons.ts | Adds a PDF icon for the PDF renderable type. |
| apps/web/partials/entity-page/readable-entity-page.tsx | Renders PDF relations in readable entity view via dynamic PDF preview. |
| apps/web/partials/entity-page/editable-entity-page.tsx | Adds PDF relation upload/edit UI and PDF chips in edit mode. |
| apps/web/partials/editor/server-content.tsx | Adds server-side rendering support for PDF blocks via <embed>. |
| apps/web/partials/editor/pdf-node.tsx | Introduces the PDF editor node with upload + metadata UI. |
| apps/web/partials/editor/id-extension.tsx | Enables auto-ID assignment for pdf nodes. |
| apps/web/partials/editor/extensions.tsx | Registers the new PdfNode extension. |
| apps/web/partials/editor/command-items.tsx | Adds /PDF slash-command insertion item. |
| apps/web/partials/diffs/changed-entity.tsx | Adds PDF relation/block diff rendering and preview behavior. |
| apps/web/design-system/uploading-pdf-state.tsx | Adds a small “uploading PDF” UI state component. |
| apps/web/design-system/icons/file-pdf.tsx | Adds a PDF file icon used throughout UI. |
| apps/web/design-system/editable-fields/pdf-preview.tsx | Adds a React-PDF based PDF preview/zoom component. |
| apps/web/design-system/editable-fields/editable-fields.tsx | Adds PagePdfField for uploading PDFs in entity edit UI. |
| apps/web/design-system/chip.tsx | Extends LinkableMediaChip to support PDF previews. |
| apps/web/core/utils/use-entity-media.ts | Adds usePdfUrlFromEntity helper hook. |
| apps/web/core/utils/property/properties.ts | Maps PDF switchable type to PDF_TYPE; updates base data type mapping. |
| apps/web/core/utils/property/properties.test.ts | Updates constants mocking to include PDF_TYPE. |
| apps/web/core/utils/diff/types.ts | Adds pdfUrl fields and introduces PdfBlockChange type. |
| apps/web/core/utils/diff/diff.ts | Adds PDF support in diff post-processing, block detection, and local diff hydration. |
| apps/web/core/types.ts | Extends core type unions to include PDF. |
| apps/web/core/sync/use-mutate.tsx | Adds storage.pdfs.createAndLink flow for PDF entity creation + linking. |
| apps/web/core/state/editor/use-editor.tsx | Adds JSON mapping & persistence behavior for PDF blocks in editor store. |
| apps/web/core/state/editor/types.ts | Extends editor content model to include pdf nodes. |
| apps/web/core/state/editor/block-types.ts | Adds PDF_TYPE to supported editor block types. |
| apps/web/core/io/rest/schemas/diff-shared.ts | Allows pdfBlock in API block diff schema. |
| apps/web/core/io/dto/snapshot-to-diff.ts | Maps snapshot pdfBlock into BlockChange. |
| apps/web/core/io/dto/relations.ts | Resolves PDF URLs from remote entity values and classifies PDF entities. |
| apps/web/core/io/dto/properties.ts | Maps PDF_TYPE renderable type to strict renderable type PDF. |
| apps/web/core/constants.ts | Introduces PDF constants (mime types, max size, type/id constants). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| import { PdfFile } from '../icons/file-pdf'; | ||
|
|
||
| pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`; |
There was a problem hiding this comment.
Partially addressed. Fixed the protocol-relative URL to use explicit https://. The recommended local bundling approach (new URL('pdfjs-dist/...', import.meta.url)) does not work with Turbopack, which this project uses. The CDN approach with version pinned via pdfjs.version is the pragmatic choice given this constraint.
…k support Rebuilds the PDF entity feature (originally PR #1357) from scratch on latest master. Adds PDF as a new renderable type alongside IMAGE and VIDEO, with full support for uploading PDFs via IPFS, previewing the first page using react-pdf, and embedding PDF blocks in the TipTap editor. Clicking a PDF preview opens the full document in a new browser tab.
…hips Rewrites pdf-node.tsx to match the image/video node pattern — when a PDF block is inserted with no src, it shows a drag-and-drop upload placeholder with file picker. Uploads via Graph.createImage, extracts the IPFS URL, and persists it using the PDF_URL property. Includes title editing, progress indicator, and context menu. Also removes the upload overlay exclusion for PDF in LinkableMediaChip so attached PDFs can be replaced in-place like images and videos.
When a PDF block is first inserted, there is no URL value yet. The editor serialization was passing undefined to getImagePath which crashed on .startsWith(). Now defaults to empty string and skips the path resolution, letting pdf-node show the upload placeholder.
- Add 'pdf' to editor id-extension nodeTypes so PDF blocks receive id/spaceId attributes (was causing blocks to be non-functional) - Replace React.lazy with next/dynamic for PdfZoom in readable entity page to avoid missing Suspense boundary crash - Add PDF_TYPE detection in v2_getRenderableEntityType so remote PDF entities are recognized as PDFs instead of generic relations - Add PDF_URL property lookup in RelationDtoLive so PDF media URLs are correctly resolved into toEntity.value - Skip PDF columns in CSV import relation resolution (3 locations) - Guard null numPages in pdf-preview to avoid showing "null page" - Add pdfBlock support to diff viewer schema, types, detection, and rendering so PDF changes appear in the review UI
classifyBlockType and snapshotBlockToChange now handle PDF_TYPE, so snapshot-based version/history diffs correctly render PDF blocks instead of falling back to textBlock.
- Use https:// for pdf.js worker URL instead of protocol-relative //
- Remove unsafe entity.values[0] fallback in PDF diff block
- Add missing mapPropertyType('PDF') test case
- Add pointer-events-none to embed in PDF chip to fix link navigation
- Guard against applying upload results after cancel in pdf-node.tsx - Add MIME type and file size validation in storage.pdfs.createAndLink - Add aria-label to media chip link for accessibility - Add typeToBaseDataType.PDF assertion to properties test
3493259 to
730f324
Compare
730f324 to
866f7fe
Compare
|
Closing as part of a sweep of the open-PR queue. Not a judgement on the work — reopen if you still want it and I will help get it current. Opened 2026-04-06 and now conflicting with master. At this distance a rebase is usually more work than redoing the change against current code, and the surrounding code has moved a long way underneath "Feat: pdfs". @b-d055 — if the idea still stands but the branch does not, a fresh PR or a ticket is probably a better route than reviving this one. Nothing is discarded: the branch and its history remain, and reopening costs a click. Context: 74 PRs were open, 25 older than two months, the oldest from February. The point is to make the queue mean something so genuinely ready work is visible rather than buried — #2449 sat ready for three days this week partly because of the noise. Only non-draft, conflicting PRs are in scope; drafts and anything still mergeable are being left alone. |
No description provided.