diff --git a/boot/boot.js b/boot/boot.js index 25101f55e..c54fa53d6 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -795,22 +795,6 @@ $tw.Tiddler.prototype.isDraft = function() { return this.hasField("draft.of"); }; -$tw.Tiddler.prototype.isModified = function() { - if(!this.isDraft()) { - return false; - } - var ignoredFields = ["created", "modified", "title", "draft.title", "draft.of", "tags"], - tiddler = this, - origTiddler = $tw.wiki.getTiddler(this.fields["draft.of"]); - if(!$tw.utils.isArrayEqual(tiddler.fields.tags,origTiddler.fields.tags)) { - return true; - } - return !Object.keys(tiddler.fields).every(function(field) { - if(ignoredFields.indexOf(field) >= 0) { return true; } - return tiddler.fields[field] === origTiddler.fields[field]; - }); -}; - /* Register and install the built in tiddler field modules */ @@ -1140,6 +1124,22 @@ $tw.Wiki.prototype.deserializeTiddlers = function(type,text,srcFields) { } }; +$tw.Wiki.prototype.isModifiedTiddler = function(title) { + var tiddler = this.getTiddler(title); + if(!tiddler.isDraft()) { + return false; + } + var ignoredFields = ["created", "modified", "title", "draft.title", "draft.of", "tags"], + origTiddler = this.getTiddler(tiddler.fields["draft.of"]); + if(!$tw.utils.isArrayEqual(tiddler.fields.tags,origTiddler.fields.tags)) { + return true; + } + return !Object.keys(tiddler.fields).every(function(field) { + if(ignoredFields.indexOf(field) >= 0) { return true; } + return tiddler.fields[field] === origTiddler.fields[field]; + }); +}; + /* Register the built in tiddler deserializer modules */ diff --git a/core/modules/widgets/navigator.js b/core/modules/widgets/navigator.js index 0f75cb7e9..40aaae9cf 100755 --- a/core/modules/widgets/navigator.js +++ b/core/modules/widgets/navigator.js @@ -315,7 +315,7 @@ NavigatorWidget.prototype.handleSaveTiddlerEvent = function(event) { {title: draftTitle} } )); - } else if(!tiddler.isModified()) { + } else if(!this.wiki.isModifiedTiddler(title)) { event.type = "tw-cancel-tiddler"; this.dispatchEvent(event); } else if(isConfirmed) {