diff --git a/src/frontend/apps/impress/src/features/docs/doc-export/blocks-mapping/imagePDF.tsx b/src/frontend/apps/impress/src/features/docs/doc-export/blocks-mapping/imagePDF.tsx index 9db1237a3..b17d18747 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-export/blocks-mapping/imagePDF.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-export/blocks-mapping/imagePDF.tsx @@ -70,6 +70,12 @@ export const blockMappingImagePDF: DocsExporterPDF['mappings']['blockMapping'][' ); }; +/** + * Renders an optional caption below an image in the PDF. + * + * @param props - Block props that may include a caption string and previewWidth. + * @returns A react-pdf Text element, or undefined when no caption is set. + */ function caption( props: Partial, ) { diff --git a/src/frontend/apps/impress/src/features/docs/doc-export/utils.ts b/src/frontend/apps/impress/src/features/docs/doc-export/utils.ts index 92685ae7c..af2b5ede6 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-export/utils.ts +++ b/src/frontend/apps/impress/src/features/docs/doc-export/utils.ts @@ -7,6 +7,12 @@ import { Canvg } from 'canvg'; import { IParagraphOptions, ShadingType } from 'docx'; import React from 'react'; +/** + * Triggers a browser download of a Blob with the given filename. + * + * @param blob - The data to download. + * @param filename - The name the downloaded file should have. + */ export function downloadFile(blob: Blob, filename: string) { const url = window.URL.createObjectURL(blob); const a = document.createElement('a'); @@ -142,6 +148,14 @@ export async function convertBlobToPng( } } +/** + * Converts BlockNote block props (background color, text color, alignment) + * into a docx IParagraphOptions object for use with the docx exporter. + * + * @param props - Partial BlockNote default props. + * @param colors - The color palette to resolve named colors. + * @returns A docx paragraph options object with shading, run color, and alignment. + */ export function docxBlockPropsToStyles( props: Partial, colors: typeof COLORS_DEFAULT,