1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Allow deleteTiddler to not modify fs (#6047)

* feat: allow deleteTiddler to not modify fs

* refactor: add new function that merely delete file in cache, and let old func calls it

* fix: self is undefined
This commit is contained in:
lin onetwo 2023-03-04 05:56:40 +08:00 committed by GitHub
parent 7f1064d14b
commit d14e775b90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -140,7 +140,7 @@ FileSystemAdaptor.prototype.deleteTiddler = function(title,callback,options) {
}
}
// Remove the tiddler from self.boot.files & return null adaptorInfo
delete self.boot.files[title];
self.deleteTiddlerInCache(title);
return callback(null,null);
});
} else {
@ -148,6 +148,16 @@ FileSystemAdaptor.prototype.deleteTiddler = function(title,callback,options) {
}
};
/*
Delete a tiddler in cache, without modifying file system.
*/
FileSystemAdaptor.prototype.deleteTiddlerInCache = function(title) {
// Only delete the tiddler if we have writable information for the file
if(this.boot.files[title]) {
delete this.boot.files[title];
};
};
if(fs) {
exports.adaptorClass = FileSystemAdaptor;
}