fix(capture): Ensure download filename has the correct extension. (#5691)
This commit is contained in:
parent
a51552a2e7
commit
38a8406a66
@ -215,7 +215,7 @@ const CornerstoneViewportDownloadForm = ({
|
|||||||
}
|
}
|
||||||
}, [viewportDimensions, showAnnotations]);
|
}, [viewportDimensions, showAnnotations]);
|
||||||
|
|
||||||
const handleDownload = async (filename: string, fileType: string) => {
|
const handleDownload = async (baseFilename: string, fileType: string) => {
|
||||||
const divForDownloadViewport = document.querySelector(
|
const divForDownloadViewport = document.querySelector(
|
||||||
`div[data-viewport-uid="${VIEWPORT_ID}"]`
|
`div[data-viewport-uid="${VIEWPORT_ID}"]`
|
||||||
);
|
);
|
||||||
@ -225,8 +225,9 @@ const CornerstoneViewportDownloadForm = ({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const filename = `${baseFilename}.${fileType}`;
|
||||||
const canvas = await html2canvas(divForDownloadViewport as HTMLElement);
|
const canvas = await html2canvas(divForDownloadViewport as HTMLElement);
|
||||||
downloadUrl(canvas.toDataURL(`image/${fileType}`, 1.0));
|
downloadUrl(canvas.toDataURL(`image/${fileType}`, 1.0), { filename });
|
||||||
};
|
};
|
||||||
|
|
||||||
const ViewportDownloadFormNew = customizationService.getCustomization(
|
const ViewportDownloadFormNew = customizationService.getCustomization(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user