Repository navigation
Support non-SVG snapshots when using MS Edge - #2
radhikalism wants to merge 1 commit into
Conversation
be2a09a to
ee427b1
Compare
|
This looks very good! Can we also push it up to the modebar download button? I'm thinking remove this block and instead in the catch look for the IE error we just threw and try again with svg? The downside of that approach is it will make modebar button downloads take longer on IE, because you have to do a lot of the work twice. I think that may be acceptable, but if we wanted to avoid it we could either a) look for a quick way to trigger that same Once this includes the modebar button, feel free to make a PR to the main plotly.js repo. |
|
D'oh, I hadn't tested the download button yet as I'm using a custom button directly invoking Doing the work twice is not likely to be a huge penalty in time performance, but I wonder if the statefulness will be tricky to manage -- in order to avoid a "Snapshotting in progress..." situation on the second attempt. I'll try it and see. Option A seems like a better approach over browser sniffing. It might be worth adding a predicate to |
No worries, that's what reviews are for! Anyway the
If that's easy to do, then absolutely, sounds like the best route! |
|
Quick question: does |
| var format = opts.format || 'png'; | ||
|
|
||
| // IE only support svg | ||
| if(Lib.isIE() && format !== 'svg') { |
There was a problem hiding this comment.
So this means Lib.isIE returns true in Edge? Is there an easy way to fix that? We could add an Lib.isMSbrowser if ever we need IE+Edge logic.
There was a problem hiding this comment.
I'd frankly vote to go for explicit feature detection - rename the current Lib.isIE to something like usesMsSaveBlob, and detect other stuff as needed like @arbscht's suggested canExportFromCanvas.
image export is currently the only place we use Lib.isIE anyway.
|
Was any more headway ever made on this issue? Would be nice to export non-SVG for Edge browser |

Allows non-SVG snapshots when using MS Edge (but not IE).
Adds:
filesaver.jstry/catcharoundcanvas.toDataURLinvocation insvgtoimg.jsand specially handlesSecurityError(only anticipated in IE but not Edge); also catches generic errorsRemoves:
download.jssvgtoimg.js