From 3fdb8f4377115a049d7d790ea0713212f411787f Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Thu, 22 May 2014 07:22:57 +0000 Subject: [PATCH] Avoid window.name security errors and make export window name configurable through config.exportWindowType (new|same) based on configurable canvas name git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2855 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svg-editor.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 17c77175..c66c33a9 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -34,6 +34,7 @@ TODOS // // STATE MAINTENANCE PROPERTIES editor.tool_scale = 1; // Dependent on icon size, so any use to making configurable instead? Used by JQuerySpinBtn.js + editor.exportWindowCt = 0; editor.langChanged = false; editor.showSaveWarning = false; editor.storagePromptClosed = false; // For use with ext-storage.js @@ -114,6 +115,7 @@ TODOS initOpacity: 1, colorPickerCSS: null, // Defaults to 'left' with a position equal to that of the fill_color or stroke_color element minus 140, and a 'bottom' equal to 40 initTool: 'select', + exportWindowType: 'new', // 'same' (todo: also support 'download') wireframe: false, showlayers: false, no_save_warning: false, @@ -3650,13 +3652,17 @@ TODOS // Open placeholder window (prevents popup) if (!customExportImage) { var str = uiStrings.notification.loadingImage; + if (curConfig.exportWindowType === 'new') { + editor.exportWindowCt++; + } + var exportWindowName = curConfig.canvasName + editor.exportWindowCt; exportWindow = window.open( 'data:text/html;charset=utf-8,' + encodeURIComponent('' + str + '

' + str + '

'), - 'svg-edit-exportWindow' + exportWindowName ); } var quality = parseInt($('#image-slider').val(), 10)/100; - svgCanvas.rasterExport(imgType, quality, (exportWindow && exportWindow.name)); + svgCanvas.rasterExport(imgType, quality, exportWindowName); }, function () { var sel = $(this); if (sel.val() === 'JPEG' || sel.val() === 'WEBP') {