Allow override of jsPDF saveAs function (jsPDF work not complete however); apply fix for issue #1209 on push buttons; fix comment

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2839 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Brett Zamir 2014-05-08 03:47:14 +00:00
parent 35e171a15f
commit 978315f944
1 changed files with 37 additions and 32 deletions

View File

@ -22,7 +22,7 @@
TODOS TODOS
1. JSDoc 1. JSDoc
*/ */
var saveAs;
(function() { (function() {
if (window.svgEditor) { if (window.svgEditor) {
@ -396,7 +396,7 @@ TODOS
* opts.open's responsibilities are: * opts.open's responsibilities are:
* - invoke a file chooser dialog in 'open' mode * - invoke a file chooser dialog in 'open' mode
* - let user pick a SVG file * - let user pick a SVG file
* - calls setCanvas.setSvgString() with the string contents of that file * - calls svgCanvas.setSvgString() with the string contents of that file
* opts.save's responsibilities are: * opts.save's responsibilities are:
* - accept the string contents of the current document * - accept the string contents of the current document
* - invoke a file chooser dialog in 'save' mode * - invoke a file chooser dialog in 'save' mode
@ -1079,6 +1079,7 @@ TODOS
}; };
// Export global for use by jsPDF // Export global for use by jsPDF
if (!saveAs) {
saveAs = function (blob, options) { saveAs = function (blob, options) {
var blobUrl = URL.createObjectURL(blob); var blobUrl = URL.createObjectURL(blob);
try { try {
@ -1107,13 +1108,17 @@ TODOS
exportWindow.location.href = blobUrl; exportWindow.location.href = blobUrl;
} }
}; };
}
var exportHandler = function(win, data) { var exportHandler = function(win, data) {
var issues = data.issues, var issues = data.issues,
type = data.type || 'PNG', type = data.type || 'PNG',
exportWindowName = data.exportWindowName,
dataURLType = (type === 'ICO' ? 'BMP' : type).toLowerCase(); dataURLType = (type === 'ICO' ? 'BMP' : type).toLowerCase();
exportWindow = window.open('', data.exportWindowName); // A hack to get the window via JSON-able name without opening a new one if (exportWindowName) {
exportWindow = window.open('', exportWindowName); // A hack to get the window via JSON-able name without opening a new one
}
if (!$('#export_canvas').length) { if (!$('#export_canvas').length) {
$('<canvas>', {id: 'export_canvas'}).hide().appendTo('body'); $('<canvas>', {id: 'export_canvas'}).hide().appendTo('body');
} }
@ -3981,8 +3986,8 @@ TODOS
var all_tools = ''; var all_tools = '';
var cur_class = 'tool_button_current'; var cur_class = 'tool_button_current';
$.each(toolnames, function(i,item) { $.each(toolnames, function(i, item) {
all_tools += '#tool_' + item + (i == toolnames.length-1 ? ',' : ''); all_tools += (i ? ',' : '') + '#tool_' + item;
}); });
$(all_tools).mousedown(function() { $(all_tools).mousedown(function() {