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) => {
node.classList.remove(SAVING_DOM_IMAGE_CLASS);
const link = document.createElement("a");
link.setAttribute("download", fileName);
link.setAttribute(
"href",
canvas.toDataURL("image/png").replace("image/png", "image/octet-stream"),
);
link.click();
link.remove();
canvas.toBlob(blob => {
if (blob) {
const link = document.createElement("a");
const url = URL.createObjectURL(blob);
link.rel = "noopener";
link.download = fileName;
link.href = url;
link.click();
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