Skip to content
Snippets Groups Projects
Unverified Commit 6abe3d4d authored by Alexander Polyankin's avatar Alexander Polyankin Committed by GitHub
Browse files

Fix png download in safari in embedding (#40130)

parent 374c0bbe
No related branches found
No related tags found
No related merge requests found
...@@ -28,14 +28,16 @@ export const saveChartImage = async (selector: string, fileName: string) => { ...@@ -28,14 +28,16 @@ export const saveChartImage = async (selector: string, fileName: string) => {
node.classList.remove(SAVING_DOM_IMAGE_CLASS); node.classList.remove(SAVING_DOM_IMAGE_CLASS);
const link = document.createElement("a"); canvas.toBlob(blob => {
if (blob) {
link.setAttribute("download", fileName); const link = document.createElement("a");
link.setAttribute( const url = URL.createObjectURL(blob);
"href", link.rel = "noopener";
canvas.toDataURL("image/png").replace("image/png", "image/octet-stream"), link.download = fileName;
); link.href = url;
link.click();
link.click(); link.remove();
link.remove(); setTimeout(() => URL.revokeObjectURL(url), 60_000);
}
});
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment