Support external (embedded) export invocation; utilize export in embedded demo

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2822 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Brett Zamir
2014-04-09 06:53:08 +00:00
parent 20361c88d1
commit 936d7d3aa4
3 changed files with 34 additions and 14 deletions

View File

@@ -38,10 +38,20 @@
function saveSvg() {
svgCanvas.getSvgString()(handleSvgData);
}
function exportSvg() {
var str = document.getElementById('svgedit').contentWindow.svgEditor.uiStrings.notification.loadingImage;
var exportWindow = window.open(
'data:text/html;charset=utf-8,' + encodeURIComponent('<title>' + str + '</title><h1>' + str + '</h1>'),
'svg-edit-exportWindow'
);
svgCanvas.rasterExport('JPEG', null, exportWindow.name);
}
// Add event handlers
$('#load').click(loadSvg);
$('#save').click(saveSvg);
$('#export').click(exportSvg);
$('body').append(
$('<iframe src="svg-editor.html?extensions=ext-xdomain-messaging.js' +
window.location.href.replace(/\?(.*)$/, '&$1') + // Append arguments to this file onto the iframe
@@ -54,6 +64,7 @@
<body>
<button id="load">Load example</button>
<button id="save">Save data</button>
<button id="export">Export data</button>
<br/>
</body>
</html>