setCustomhandlers

Further whittling away at differences between
Instiki's and the main branch of SVG-Edit.
Now, the saveHandler is set from within the calling
page.

If the editor was opened from Instiki, choosing "Save Image"
now closes the editor window. To leave it open was kinda confusing.

Also sync with latest SVG-Edit changes.
This commit is contained in:
Jacques Distler 2010-02-17 14:28:00 -06:00
parent 4475f02586
commit ea581a50ae
6 changed files with 78 additions and 24 deletions

View file

@ -85,8 +85,23 @@ function setupSVGedit(path){
var editor = window.open(path, 'Edit SVG graphic', 'status=1,resizable=1,scrollbars=1');
if (selected) {
editor.addEventListener("load", function() {
editor.svgCanvas.setCustomHandlers({
'save': function(window,svg){
window.opener.postMessage(svg, window.location.protocol + '//' + window.location.host);
window.close();
}
});
editor.svgCanvas.setSvgString(selected);
}, true);
} else {
editor.addEventListener("load", function() {
editor.svgCanvas.setCustomHandlers({
'save': function(window,svg){
window.opener.postMessage(svg, window.location.protocol + '//' + window.location.host);
window.close();
}
});
}, true);
}
SVGeditButton.disabled = true;
SVGeditButton.value = 'Create SVG graphic';