✨(docx) fix image overflow by limiting width to 600px during export
ensures all images keep proportions and stay within page bounds in docx export Signed-off-by: Cyril <c.gromoff@gmail.com>
This commit is contained in:
@@ -10,6 +10,7 @@ and this project adheres to
|
|||||||
|
|
||||||
- ♿(frontend) improve accessibility:
|
- ♿(frontend) improve accessibility:
|
||||||
- ♿(frontend) improve ARIA in doc grid and editor for a11y #1519
|
- ♿(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
|
## [3.9.0] - 2025-11-10
|
||||||
|
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ export const blockMappingImageDocx: DocsExporterDocx['mappings']['blockMapping']
|
|||||||
|
|
||||||
const { width, height } = dimensions;
|
const { width, height } = dimensions;
|
||||||
|
|
||||||
if (previewWidth && previewWidth > MAX_WIDTH) {
|
// Ensure the final width never exceeds MAX_WIDTH to prevent images
|
||||||
previewWidth = MAX_WIDTH;
|
// from overflowing the page width in the exported document
|
||||||
}
|
const finalWidth = Math.min(previewWidth || width, MAX_WIDTH);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
new Paragraph({
|
new Paragraph({
|
||||||
@@ -71,8 +71,8 @@ export const blockMappingImageDocx: DocsExporterDocx['mappings']['blockMapping']
|
|||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
transformation: {
|
transformation: {
|
||||||
width: previewWidth || width,
|
width: finalWidth,
|
||||||
height: ((previewWidth || width) / width) * height,
|
height: (finalWidth / width) * height,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user