Made default save behaviour alert the user on how to saveand when necessary inform of FF bug (on first time saved/bug encountered)
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1385 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
3cff24713b
commit
6f50f5d55c
|
@ -175,35 +175,31 @@ function svg_edit_setup() {
|
||||||
// Creates and opens an HTML page that provides a link to the SVG, a preview, and the markup.
|
// Creates and opens an HTML page that provides a link to the SVG, a preview, and the markup.
|
||||||
// Also includes warning about Mozilla bug #308590 when applicable
|
// Also includes warning about Mozilla bug #308590 when applicable
|
||||||
|
|
||||||
var title = svgCanvas.getImageTitle() || "Untitled";
|
var win = window.open("data:image/svg+xml;base64," + Utils.encode64(svg));
|
||||||
var res = svgCanvas.getResolution();
|
|
||||||
var str = encodeURIComponent(svg);
|
|
||||||
var note = '';
|
|
||||||
// Check if FF and has <defs/>
|
|
||||||
if(navigator.userAgent.indexOf('Gecko/') !== -1 && svg.indexOf('<defs') !== -1) {
|
|
||||||
note = "<p><b>NOTE:</b> Due to a <a href='https://bugzilla.mozilla.org/show_bug.cgi?id=308590'>bug</a> in your browser, the image may appear wrong (missing gradients or elements). It will however appear correct once saved as a file.</p>";
|
|
||||||
}
|
|
||||||
|
|
||||||
var htmlpage = "\
|
// Alert will only appear the first time saved OR the first time the bug is encountered
|
||||||
<!doctype html>\
|
var done = $.pref('save_notice_done');
|
||||||
<title>SVG-Edit saved image: " + title + "</title>\
|
if(done !== "all") {
|
||||||
<script>\
|
|
||||||
window.onload = function() {\
|
var note = 'Select "Save As..." in your browser to save this image as an SVG file.';
|
||||||
var str = '" + str + "';\
|
|
||||||
var data = 'data:image/svg+xml;base64," + Utils.encode64(svg) + "';\
|
// Check if FF and has <defs/>
|
||||||
document.getElementById('ta').value = decodeURIComponent(str);\
|
if(navigator.userAgent.indexOf('Gecko/') !== -1) {
|
||||||
document.getElementById('frame').src = data;\
|
if(svg.indexOf('<defs') !== -1) {
|
||||||
document.getElementById('view').href = data;\
|
note += "\n\nNOTE: Due to a bug in your browser, this image may appear wrong (missing gradients or elements). It will however appear correct once actually saved.";
|
||||||
}\
|
$.pref('save_notice_done', 'all');
|
||||||
</script>\
|
done = "all";
|
||||||
<h2>Download</h2>\
|
} else {
|
||||||
<p><a id=view>Download image</a> (Follow link, then choose \"Save As\" on your browser)</p>\
|
$.pref('save_notice_done', 'part');
|
||||||
<h2>Preview</h2>" + note +
|
}
|
||||||
"<iframe id=frame width='" + res.w + "' height='" + res.h + "'></iframe>\
|
} else {
|
||||||
<h2>Markup</h2>\
|
$.pref('save_notice_done', 'all');
|
||||||
<textarea id=ta style='width:100%' rows=10></textarea>\
|
}
|
||||||
";
|
|
||||||
window.open("data:text/html;charset=utf-8;base64," + Utils.encode64(htmlpage));
|
if(done !== 'part') {
|
||||||
|
win.alert(note);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// called when we've selected a different element
|
// called when we've selected a different element
|
||||||
|
|
Loading…
Reference in New Issue