Document block — support .docx, .xlsx, .pptx, ODF, .txt, .csv files.
Context
GoDAM Central shipped a document pipeline (godam-core#1307, spec in issue #1170). Central now accepts Word, Excel, PowerPoint, OpenDocument, TXT and CSV alongside PDF, converts each to a preview PDF server-side (Gotenberg/LibreOffice), and exposes it as a new job field preview_pdf_url.
The WordPress plugin is still PDF-only end to end: godam/pdf (title "Document") accepts application/pdf only, the transcoder handler only sends .pdf to Central, and the front end embeds the file in <object type="application/pdf">.
Goal: upload any supported document in WP → it transcodes on Central → the block renders its preview PDF on the front end through a chrome-less pdf.js viewer, so a visitor looking at a .docx never sees that it is really a PDF. Downloads always serve the original file, never the generated preview.
Decisions taken
- pdf.js renders every document, native
.pdf included — one code path, consistent chrome-less look.
- Same library as Central:
react-pdf@9.2.1 + pdfjs-dist@4.8.69 (react-pdf pins that exact pdfjs version).
- Files with no preview (password-protected) get a download-only panel; no in-browser unlock this iteration.
- In scope: the block, the transcode/callback plumbing, the Media Library "GoDAM" tab, the Elementor / WPBakery / shortcode wrappers, and retranscoding existing documents.
Document block — support .docx, .xlsx, .pptx, ODF, .txt, .csv files.
Context
GoDAM Central shipped a document pipeline (godam-core#1307, spec in issue #1170). Central now accepts Word, Excel, PowerPoint, OpenDocument, TXT and CSV alongside PDF, converts each to a preview PDF server-side (Gotenberg/LibreOffice), and exposes it as a new job field
preview_pdf_url.The WordPress plugin is still PDF-only end to end:
godam/pdf(title "Document") acceptsapplication/pdfonly, the transcoder handler only sends.pdfto Central, and the front end embeds the file in<object type="application/pdf">.Goal: upload any supported document in WP → it transcodes on Central → the block renders its preview PDF on the front end through a chrome-less pdf.js viewer, so a visitor looking at a
.docxnever sees that it is really a PDF. Downloads always serve the original file, never the generated preview.Decisions taken
.pdfincluded — one code path, consistent chrome-less look.react-pdf@9.2.1+pdfjs-dist@4.8.69(react-pdf pins that exact pdfjs version).