Add a default autosave canvas to localstorage
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2273 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
944e652a01
commit
89416b0ac6
|
@ -40,6 +40,7 @@
|
|||
// changed in the UI and are stored in the browser, config can not
|
||||
|
||||
curConfig = {
|
||||
canvasName: 'default',
|
||||
canvas_expansion: 3,
|
||||
dimensions: [640,480],
|
||||
initFill: {
|
||||
|
@ -254,6 +255,12 @@
|
|||
} else if(urldata.url) {
|
||||
svgEditor.loadFromURL(urldata.url);
|
||||
}
|
||||
} else {
|
||||
var name = 'svgedit-' + Editor.curConfig.canvasName;
|
||||
var cached = window.localStorage.getItem(name);
|
||||
if (cached) {
|
||||
Editor.loadFromString(cached);
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
|
@ -4364,6 +4371,13 @@
|
|||
canv_menu.enableContextMenuItems('#delete,#cut,#copy');
|
||||
|
||||
window.onbeforeunload = function() {
|
||||
|
||||
if ('localStorage' in window) {
|
||||
var name = 'svgedit-' + Editor.curConfig.canvasName;
|
||||
window.localStorage.setItem(name, svgCanvas.getSvgString());
|
||||
Editor.show_save_warning = false;
|
||||
}
|
||||
|
||||
// Suppress warning if page is empty
|
||||
if(undoMgr.getUndoStackSize() === 0) {
|
||||
Editor.show_save_warning = false;
|
||||
|
|
Loading…
Reference in New Issue