mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-28 17:00:01 +00:00
Fix: Don't set dirty flag when shadow tiddler changes (#8903)
Adds `shadow` and `normal` flags to each entry in `changedTiddlers`, indicating whether the corresponding version of the tiddler has changed. Makes the saver handler ignore any changes that aren't flagged `normal`. Fixes #8902.
This commit is contained in:
parent
843f133f5e
commit
94b325f41f
@ -46,8 +46,10 @@ function SaverHandler(options) {
|
||||
// Filter the changes so that we only count changes to tiddlers that we care about
|
||||
var filteredChanges = self.filterFn.call(self.wiki,function(iterator) {
|
||||
$tw.utils.each(changes,function(change,title) {
|
||||
var tiddler = self.wiki.getTiddler(title);
|
||||
iterator(tiddler,title);
|
||||
if(change.normal) {
|
||||
var tiddler = self.wiki.getTiddler(title);
|
||||
iterator(tiddler,title);
|
||||
}
|
||||
});
|
||||
});
|
||||
// Adjust the number of changes
|
||||
|
@ -75,7 +75,7 @@ exports.startup = function() {
|
||||
$tw.wiki.unpackPluginTiddlers();
|
||||
// Queue change events for the changed shadow tiddlers
|
||||
$tw.utils.each(Object.keys(changedShadowTiddlers),function(title) {
|
||||
$tw.wiki.enqueueTiddlerEvent(title,changedShadowTiddlers[title]);
|
||||
$tw.wiki.enqueueTiddlerEvent(title,changedShadowTiddlers[title], true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -141,12 +141,15 @@ This method should be called after the changes it describes have been made to th
|
||||
title: Title of tiddler
|
||||
isDeleted: defaults to false (meaning the tiddler has been created or modified),
|
||||
true if the tiddler has been deleted
|
||||
isShadow: defaults to false (meaning the change applies to the normal tiddler),
|
||||
true if the tiddler being changed is a shadow tiddler
|
||||
*/
|
||||
exports.enqueueTiddlerEvent = function(title,isDeleted) {
|
||||
exports.enqueueTiddlerEvent = function(title,isDeleted,isShadow) {
|
||||
// Record the touch in the list of changed tiddlers
|
||||
this.changedTiddlers = this.changedTiddlers || Object.create(null);
|
||||
this.changedTiddlers[title] = this.changedTiddlers[title] || Object.create(null);
|
||||
this.changedTiddlers[title][isDeleted ? "deleted" : "modified"] = true;
|
||||
this.changedTiddlers[title][isShadow ? "shadow" : "normal"] = true;
|
||||
// Increment the change count
|
||||
this.changeCount = this.changeCount || Object.create(null);
|
||||
if($tw.utils.hop(this.changeCount,title)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user