Skip to content

Commit 41c3126

Browse files
make IE download use format:svg and lint
1 parent 642ddba commit 41c3126

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/components/modebar/buttons.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,16 @@ modeBarButtons.toImage = {
4949
title: 'Download plot as a png',
5050
icon: Icons.camera,
5151
click: function(gd) {
52+
var format = 'png';
53+
5254
Lib.notifier('Taking snapshot - this may take a few seconds', 'long');
5355

54-
downloadImage(gd)
56+
if(Lib.isIE()){
57+
Lib.notifier('IE only supports svg. Changing format to svg.', 'long');
58+
format = 'svg';
59+
}
60+
61+
downloadImage(gd, {'format':format})
5562
.then(function(filename) {
5663
Lib.notifier('Snapshot succeeded - ' + filename, 'long');
5764
})

src/snapshot/download.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function downloadImage(gd, opts) {
4040
// does not allow toDataURL
4141
// svg format will work though
4242
if(Lib.isIE() && opts.format !== 'svg') {
43-
reject(new Error('Sorry IE does not support downloading from canvas.'));
43+
reject(new Error('Sorry IE does not support downloading from canvas. Try {format:"svg"} instead.'));
4444
}
4545

4646
gd._snapshotInProgress = true;

src/snapshot/svgtoimg.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function svgToImg(opts) {
3535
// Leave here just in case the CORS/tainted IE issue gets resolved
3636
if(Lib.isIE()) {
3737
// replace double quote with single quote
38-
svg = svg.replace(/"/gi,"'");
38+
svg = svg.replace(/"/gi,'\'');
3939
// url in svg are single quoted
4040
// since we changed double to single
4141
// we'll need to change these to double-quoted

0 commit comments

Comments
 (0)