-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Toimage bug #604
Toimage bug #604
Conversation
…eturn proper url for svg downloads
@@ -86,7 +86,7 @@ function svgToImg(opts) { | |||
imgData = canvas.toDataURL('image/webp'); | |||
break; | |||
case 'svg': | |||
imgData = svg; | |||
imgData = url; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The imgData
must be an actual URL to work as a download via a link.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good to know!
Great. @mdtusz Can you try this patch on browserstack (if you haven't already) ? I think the easiest way is:
|
Looks all good for Chrome, FF, Safari, and IE11 (svg)! 🎉 |
💃 |
From which version of Safari does this work? I have plotly v.1.23.0 and downloading images (scattergl plot specifically is what I tested) doesn't work in Safari 8. |
@kimli42 For reference: Safari 8 was released on Oct 16, 2014. Current is Safari 10. Are you able to download this plot? https://plot.ly/~chris/17389.embed It works for me in Safari 10. |
Unfortunately, you can't upgrade to the latest Safari (on Mac) without upgrading the OS. That is why I was asking if anyone else was able to use this feature in Safari 8. |
Is there a specific error in the console? There is already some code to handle specific browsers, so it's definitely a tricky issue to get working across all browsers past and present. |
There's no error in the console. I've encountered this before trying to developing a file downloader in legacy Safari. |
I've seen the closed issue #250, but can't get .png downloads to work with the latest plotly and Safari 10.0. |
Fixes #600.
This PR fixes a nasty little bug with image downloads. The culprit was font-family strings that were quoted and breaking the svg string used for image conversions.
The fix is not exactly pretty, but should be more robust now (previously, the quotation marks were escaped before the svg was converted to a string - Chrome seems to not care for that and automatically replaces the double quotation marks.