giteabot backport / giteabot (push) Canceled after 0s
giteabot / giteabot (push) Canceled after 0s
release-nightly / nightly-binary (push) Canceled after 0s
release-nightly / nightly-container (push) Canceled after 0s
cache-seeder / gobuild (push) Canceled after 0s
cache-seeder / lint (bindata, lint-backend) (push) Canceled after 0s
release-nightly-snapcraft / build-and-publish (push) Canceled after 0s
Includes direct password setup links in registration emails. Assisted-by: Codex:GPT-5
20 lines
803 B
TypeScript
20 lines
803 B
TypeScript
import type {InplaceRenderPlugin} from '../plugin.ts';
|
|
|
|
export function newInplacePluginPdfViewer(): InplaceRenderPlugin {
|
|
return {
|
|
name: 'pdf-viewer',
|
|
|
|
canHandle: (filename: string, _mimeType: string): boolean => filename.toLowerCase().endsWith('.pdf'),
|
|
|
|
async render(container: HTMLElement, fileUrl: string): Promise<void> {
|
|
const PDFObject = await import('pdfobject');
|
|
// TODO: the PDFObject library does not support dynamic height adjustment,
|
|
// TODO: it seems that this render must be an inplace render, because the URL must be accessible from the current context
|
|
container.style.height = `${window.innerHeight - 100}px`;
|
|
if (!PDFObject.default.embed(fileUrl, container)) {
|
|
throw new Error('Unable to render the PDF file');
|
|
}
|
|
},
|
|
};
|
|
}
|