Separate the save handler into the HTML editor portion so that it can be re-bound

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@404 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Jeff Schiller
2009-08-17 21:55:47 +00:00
parent 752b45f20d
commit 9726d1b417
2 changed files with 10 additions and 9 deletions

View File

@@ -28,6 +28,14 @@ function svg_edit_setup() {
var fillPaint = new $.jGraduate.Paint({solidColor: "FF0000"}); // solid red
var strokePaint = new $.jGraduate.Paint({solidColor: "000000"}); // solid black
// TODO: Unfortunately Mozilla does not handle internal references to gradients
// inside a data: URL document. This means that any elements filled/stroked
// with a gradient will appear black in Firefox, etc. See bug 308590
// https://bugzilla.mozilla.org/show_bug.cgi?id=308590
var saveHandler = function(window,svg) {
window.open("data:image/svg+xml;base64," + Utils.encode64(svg));
};
// called when we've selected a different element
var selectedChanged = function(window,elems) {
// if elems[1] is present, then we have more than one element
@@ -240,6 +248,7 @@ function svg_edit_setup() {
// bind the selected event to our function that handles updates to the UI
svgCanvas.bind("selected", selectedChanged);
svgCanvas.bind("changed", elementChanged);
svgCanvas.bind("saved", saveHandler);
var str = '<div class="palette_item" style="background-image: url(\'images/none.png\');" data-rgb="none"></div>'
$.each(palette, function(i,item){

View File

@@ -1782,7 +1782,7 @@ function SvgCanvas(c)
var str = "<?xml version=\"1.0\" standalone=\"no\"?>\n";
// no need for doctype, see http://jwatt.org/svg/authoring/#doctype-declaration
str += svgToString(svgroot, 0);
this.saveHandler(str);
call("saved", str);
};
this.getSvgString = function() {
@@ -2261,14 +2261,6 @@ function SvgCanvas(c)
$(container).mousedown(mouseDown);
$(container).mousemove(mouseMove);
// TODO: Unfortunately Mozilla does not handle internal references to gradients
// inside a data: URL document. This means that any elements filled/stroked
// with a gradient will appear black in Firefox, etc. See bug 308590
// https://bugzilla.mozilla.org/show_bug.cgi?id=308590
this.saveHandler = function(svg) {
window.open("data:image/svg+xml;base64," + Utils.encode64(svg));
};
this.deleteSelectedElements = function() {
var batchCmd = new BatchCommand("Delete Elements");
var len = selectedElements.length;