diff --git a/CHANGELOG.md b/CHANGELOG.md index 9598bd9c..582d4fee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to - ♿(frontend) improve accessibility: - ♿(frontend) improve ARIA in doc grid and editor for a11y #1519 +- 🐛(docx) fix image overflow by limiting width to 600px during export #1525 ## [3.9.0] - 2025-11-10 diff --git a/src/frontend/apps/impress/src/features/docs/doc-export/blocks-mapping/imageDocx.tsx b/src/frontend/apps/impress/src/features/docs/doc-export/blocks-mapping/imageDocx.tsx index c53a5e1d..868ba0cf 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-export/blocks-mapping/imageDocx.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-export/blocks-mapping/imageDocx.tsx @@ -50,9 +50,9 @@ export const blockMappingImageDocx: DocsExporterDocx['mappings']['blockMapping'] const { width, height } = dimensions; - if (previewWidth && previewWidth > MAX_WIDTH) { - previewWidth = MAX_WIDTH; - } + // Ensure the final width never exceeds MAX_WIDTH to prevent images + // from overflowing the page width in the exported document + const finalWidth = Math.min(previewWidth || width, MAX_WIDTH); return [ new Paragraph({ @@ -71,8 +71,8 @@ export const blockMappingImageDocx: DocsExporterDocx['mappings']['blockMapping'] } : undefined, transformation: { - width: previewWidth || width, - height: ((previewWidth || width) / width) * height, + width: finalWidth, + height: (finalWidth / width) * height, }, }), ],