1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-11-12 13:33:44 +00:00

BrowserStorage: Make sure tiddlers loaded from local storage mark wiki as dirty

Thanks @xcazin
This commit is contained in:
Jermolene
2019-02-08 15:38:23 +00:00
parent 2710fae71d
commit 6ff7a7d261
3 changed files with 20 additions and 4 deletions

View File

@@ -12,6 +12,8 @@ Startup code injected as raw markup
// Need to initialise these because we run before bootprefix.js and boot.js
$tw = window.$tw || Object.create(null);
$tw.hooks = $tw.hooks || { names: {}};
$tw.boot = $tw.boot || {};
$tw.boot.preloadDirty = $tw.boot.preloadDirty || [];
// Hook the point in the startup process when the tiddlers have been loaded but plugins not unpacked
var hookName = "th-boot-tiddlers-loaded";
@@ -48,14 +50,17 @@ function hookBootTiddlersLoaded() {
if(existingTiddler && existingTiddler.isEqual(incomingTiddler)) {
// If the incoming tiddler is the same as the existing then we can delete the local storage version
window.localStorage.removeItem(key);
} else {
$tw.wiki.addTiddler(incomingTiddler);
log.push(title);
}
$tw.wiki.addTiddler(incomingTiddler);
log.push(title);
}
}
}
}
}
// Make sure that all the tiddlers we've loaded are marked as dirty at startup
Array.prototype.push.apply($tw.boot.preloadDirty,log);
// Save the log
$tw.wiki.addTiddler({
title: "$:/temp/BrowserStorage/Log",