Fix Issue 909: editor-wide access to the show_save_warning bit (applied patch by adambender)
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2056 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
@@ -179,7 +179,7 @@
|
|||||||
svgCanvas.open = opts.open;
|
svgCanvas.open = opts.open;
|
||||||
}
|
}
|
||||||
if(opts.save) {
|
if(opts.save) {
|
||||||
show_save_warning = false;
|
Editor.show_save_warning = false;
|
||||||
svgCanvas.bind("saved", opts.save);
|
svgCanvas.bind("saved", opts.save);
|
||||||
}
|
}
|
||||||
if(opts.pngsave) {
|
if(opts.pngsave) {
|
||||||
@@ -480,7 +480,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
Editor.canvas = svgCanvas = new $.SvgCanvas(document.getElementById("svgcanvas"), curConfig);
|
Editor.canvas = svgCanvas = new $.SvgCanvas(document.getElementById("svgcanvas"), curConfig);
|
||||||
|
Editor.show_save_warning = false;
|
||||||
var palette = ["#000000", "#3f3f3f", "#7f7f7f", "#bfbfbf", "#ffffff",
|
var palette = ["#000000", "#3f3f3f", "#7f7f7f", "#bfbfbf", "#ffffff",
|
||||||
"#ff0000", "#ff7f00", "#ffff00", "#7fff00",
|
"#ff0000", "#ff7f00", "#ffff00", "#7fff00",
|
||||||
"#00ff00", "#00ff7f", "#00ffff", "#007fff",
|
"#00ff00", "#00ff7f", "#00ffff", "#007fff",
|
||||||
@@ -502,7 +502,6 @@
|
|||||||
workarea = $("#workarea"),
|
workarea = $("#workarea"),
|
||||||
canv_menu = $("#cmenu_canvas"),
|
canv_menu = $("#cmenu_canvas"),
|
||||||
layer_menu = $("#cmenu_layers"),
|
layer_menu = $("#cmenu_layers"),
|
||||||
show_save_warning = false,
|
|
||||||
exportWindow = null,
|
exportWindow = null,
|
||||||
tool_scale = 1,
|
tool_scale = 1,
|
||||||
zoomInIcon = 'crosshair',
|
zoomInIcon = 'crosshair',
|
||||||
@@ -600,7 +599,7 @@
|
|||||||
var orig_title = $('title:first').text();
|
var orig_title = $('title:first').text();
|
||||||
|
|
||||||
var saveHandler = function(window,svg) {
|
var saveHandler = function(window,svg) {
|
||||||
show_save_warning = false;
|
Editor.show_save_warning = false;
|
||||||
|
|
||||||
// by default, we add the XML prolog back, systems integrating SVG-edit (wikis, CMSs)
|
// by default, we add the XML prolog back, systems integrating SVG-edit (wikis, CMSs)
|
||||||
// can just provide their own custom save handler and might not want the XML prolog
|
// can just provide their own custom save handler and might not want the XML prolog
|
||||||
@@ -755,7 +754,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
show_save_warning = true;
|
Editor.show_save_warning = true;
|
||||||
|
|
||||||
// we update the contextual panel with potentially new
|
// we update the contextual panel with potentially new
|
||||||
// positional/sizing information (we DON'T want to update the
|
// positional/sizing information (we DON'T want to update the
|
||||||
@@ -4358,11 +4357,11 @@
|
|||||||
window.onbeforeunload = function() {
|
window.onbeforeunload = function() {
|
||||||
// Suppress warning if page is empty
|
// Suppress warning if page is empty
|
||||||
if(undoMgr.getUndoStackSize() === 0) {
|
if(undoMgr.getUndoStackSize() === 0) {
|
||||||
show_save_warning = false;
|
Editor.show_save_warning = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// show_save_warning is set to "false" when the page is saved.
|
// show_save_warning is set to "false" when the page is saved.
|
||||||
if(!curConfig.no_save_warning && show_save_warning) {
|
if(!curConfig.no_save_warning && Editor.show_save_warning) {
|
||||||
// Browser already asks question about closing the page
|
// Browser already asks question about closing the page
|
||||||
return uiStrings.notification.unsavedChanges;
|
return uiStrings.notification.unsavedChanges;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user