Fix exportImage behavior if multiple setCustomHandlers calls are made

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2843 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Brett Zamir 2014-05-15 05:16:39 +00:00
parent b574628d36
commit bf8c5308f2
1 changed files with 4 additions and 4 deletions

View File

@ -42,8 +42,8 @@ var saveAs;
var svgCanvas, urldata, var svgCanvas, urldata,
Utils = svgedit.utilities, Utils = svgedit.utilities,
isReady = false, isReady = false,
customExportImage = false,
callbacks = [], callbacks = [],
customHandlers = {},
/** /**
* PREFS AND CONFIG * PREFS AND CONFIG
*/ */
@ -420,9 +420,9 @@ var saveAs;
svgCanvas.bind('saved', opts.save); svgCanvas.bind('saved', opts.save);
} }
if (opts.exportImage) { if (opts.exportImage) {
svgCanvas.bind('exported', checkCanvg(opts.exportImage)); customExportImage = opts.exportImage;
svgCanvas.bind('exported', checkCanvg(customExportImage));
} }
customHandlers = opts;
}); });
}; };
@ -3649,7 +3649,7 @@ var saveAs;
return; return;
} }
// Open placeholder window (prevents popup) // Open placeholder window (prevents popup)
if (!customHandlers.exportImage) { if (!customExportImage) {
var str = uiStrings.notification.loadingImage; var str = uiStrings.notification.loadingImage;
exportWindow = window.open( exportWindow = window.open(
'data:text/html;charset=utf-8,' + encodeURIComponent('<title>' + str + '</title><h1>' + str + '</h1>'), 'data:text/html;charset=utf-8,' + encodeURIComponent('<title>' + str + '</title><h1>' + str + '</h1>'),