1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-28 15:08:46 +00:00

More browser storage fixes

See 698733a4a
This commit is contained in:
Jeremy Ruston 2019-05-29 09:37:48 +01:00
parent 698733a4ad
commit c80fcf19c0

View File

@ -80,6 +80,7 @@ function saveTiddlerToLocalStorage(title,options) {
// Get the tiddler // Get the tiddler
var tiddler = $tw.wiki.getTiddler(title); var tiddler = $tw.wiki.getTiddler(title);
if(tiddler) { if(tiddler) {
console.log("browser-storage: Saving",title);
// Get the JSON of the tiddler // Get the JSON of the tiddler
var json = JSON.stringify(tiddler.getFieldStrings()); var json = JSON.stringify(tiddler.getFieldStrings());
// Try to save it to local storage // Try to save it to local storage
@ -95,13 +96,16 @@ function saveTiddlerToLocalStorage(title,options) {
// No point in keeping old values around for this tiddler // No point in keeping old values around for this tiddler
window.localStorage.removeItem(options.prefix + title); window.localStorage.removeItem(options.prefix + title);
} else { } else {
throw e; console.log("Browser-storage error:",e);
} }
} }
console.log("browser-storage: Saving",title);
} else { } else {
window.localStorage.removeItem(options.prefix + title);
console.log("browser-storage: Deleting",title); console.log("browser-storage: Deleting",title);
try {
window.localStorage.removeItem(options.prefix + title);
} catch(e) {
console.log("Browser-storage error:",e);
}
} }
} }