diff --git a/boot/boot.js b/boot/boot.js
index c54fa53d6..658f8e980 100644
--- a/boot/boot.js
+++ b/boot/boot.js
@@ -85,18 +85,6 @@ $tw.utils.each = function(object,callback) {
}
};
-/*
-Check if an array is equal by value and by reference.
-*/
-$tw.utils.isArrayEqual = function(array1,array2) {
- if(array1 === array2) { return true; }
- array1 = array1 || []; array2 = array2 || [];
- if(array1.length !== array2.length) { return false; }
- return array1.every(function(value,index) {
- return value === array2[index];
- });
-};
-
/*
Helper for making DOM elements
tag: tag name
@@ -791,10 +779,6 @@ $tw.Tiddler.prototype.hasField = function(field) {
return $tw.utils.hop(this.fields,field);
};
-$tw.Tiddler.prototype.isDraft = function() {
- return this.hasField("draft.of");
-};
-
/*
Register and install the built in tiddler field modules
*/
@@ -1124,22 +1108,6 @@ $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/language/en-GB/EditTemplate.multids b/core/language/en-GB/EditTemplate.multids
index d6eb2a525..e5625c351 100644
--- a/core/language/en-GB/EditTemplate.multids
+++ b/core/language/en-GB/EditTemplate.multids
@@ -4,11 +4,12 @@ Body/Hint: Use [[wiki text|http://tiddlywiki.com/static/WikiText.html]] to add f
Body/Placeholder: Type the text for this tiddler
Body/Preview/Button/Hide: hide preview
Body/Preview/Button/Show: show preview
-Body/ShadowWarning: You are editing a shadow tiddler. Any changes will override the default version.
Fields/Add/Button: add
Fields/Add/Name/Placeholder: field name
Fields/Add/Prompt: Add a new field:
Fields/Add/Value/Placeholder: field value
+Shadow/Warning: This is a shadow tiddler. Any changes will override the default version
+Shadow/OverriddenWarning: This is a modified shadow tiddler. You can revert to the default version by deleting this tiddler
Tags/Add/Button: add
Tags/Add/Placeholder: tag name
Type/Placeholder: content type
diff --git a/core/language/en-GB/Misc.multids b/core/language/en-GB/Misc.multids
index 35502b737..0718b08b8 100644
--- a/core/language/en-GB/Misc.multids
+++ b/core/language/en-GB/Misc.multids
@@ -6,7 +6,7 @@ CloseAll/Button: close all
ConfirmCancelTiddler: Do you wish to discard changes to the tiddler "<$text text=<
>/>"?
ConfirmDeleteTiddler: Do you wish to delete the tiddler "<$text text=<>/>"?
ConfirmOverwriteTiddler: Do you wish to overwrite the tiddler "<$text text=<>/>"?
-ConfirmEditShadowTiddler: Your about to edit a ShaddowTiddler. This will override the default system making upgrading non-trivial. Are you sure you want to edit "<$text text=<>/>"?
+ConfirmEditShadowTiddler: You are about to edit a ShadowTiddler. Any changes will override the default system making future upgrades non-trivial. Are you sure you want to edit "<$text text=<>/>"?
InvalidFieldName: Illegal characters in field name "<$text text=<>/>". Fields can only contain lowercase letters and the characters underscore (`_`), hyphen (`-`) and period (`.`)
MissingTiddler/Hint: Missing tiddler "<$text text=<>/>" - click {{$:/core/images/edit-button}} to create
RecentChanges/DateFormat: DDth MMM YYYY
diff --git a/core/modules/tiddler.js b/core/modules/tiddler.js
index 7b59b8c77..6529970d3 100644
--- a/core/modules/tiddler.js
+++ b/core/modules/tiddler.js
@@ -20,6 +20,10 @@ exports.isPlugin = function() {
return this.fields.type === "application/json" && this.hasField("plugin-type");
}
+exports.isDraft = function() {
+ return this.hasField("draft.of");
+};
+
exports.getFieldString = function(field) {
var value = this.fields[field];
// Check for a missing field
diff --git a/core/modules/utils/utils.js b/core/modules/utils/utils.js
index cf92a95b7..5a01fd387 100644
--- a/core/modules/utils/utils.js
+++ b/core/modules/utils/utils.js
@@ -33,6 +33,23 @@ exports.count = function(object) {
return s;
};
+/*
+Check if an array is equal by value and by reference.
+*/
+exports.isArrayEqual = function(array1,array2) {
+ if(array1 === array2) {
+ return true;
+ }
+ array1 = array1 || [];
+ array2 = array2 || [];
+ if(array1.length !== array2.length) {
+ return false;
+ }
+ return array1.every(function(value,index) {
+ return value === array2[index];
+ });
+};
+
/*
Push entries onto an array, removing them first if they already exist in the array
array: array to modify (assumed to be free of duplicates)
@@ -481,6 +498,6 @@ exports.timer = function(base) {
m = m - base;
}
return m;
-}
+};
})();
diff --git a/core/modules/widgets/navigator.js b/core/modules/widgets/navigator.js
index 40aaae9cf..584e45dbe 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(!this.wiki.isModifiedTiddler(title)) {
+ } else if(!this.wiki.isDraftModified(title)) {
event.type = "tw-cancel-tiddler";
this.dispatchEvent(event);
} else if(isConfirmed) {
diff --git a/core/modules/wiki.js b/core/modules/wiki.js
index 75b6411b2..c838a9d29 100755
--- a/core/modules/wiki.js
+++ b/core/modules/wiki.js
@@ -1060,4 +1060,25 @@ exports.readFile = function(file,callback) {
}
};
+/*
+Check whether the specified draft tiddler has been modified
+*/
+$tw.Wiki.prototype.isDraftModified = 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];
+ });
+};
+
})();
diff --git a/core/ui/EditTemplate/shadow.tid b/core/ui/EditTemplate/shadow.tid
new file mode 100644
index 000000000..8592e0ad8
--- /dev/null
+++ b/core/ui/EditTemplate/shadow.tid
@@ -0,0 +1,19 @@
+title: $:/core/ui/EditTemplate/shadow
+tags: $:/tags/EditTemplate
+
+\define lingo-base() $:/language/EditTemplate/Shadow/
+<$list filter="[all[current]get[draft.of]is[shadow]!is[tiddler]]">
+
+
+<>
+
+
+$list>
+
+<$list filter="[all[current]get[draft.of]is[shadow]is[tiddler]]">
+
+
+<>
+
+
+$list>
diff --git a/core/ui/EditTemplate/shadowWarning.tid b/core/ui/EditTemplate/shadowWarning.tid
deleted file mode 100644
index ba4da6a99..000000000
--- a/core/ui/EditTemplate/shadowWarning.tid
+++ /dev/null
@@ -1,11 +0,0 @@
-title: $:/core/ui/EditTemplate/shadowWarning
-tags: $:/tags/EditTemplate
-
-\define lingo-base() $:/language/EditTemplate/
-<$list filter="[all[current]get[draft.of]is[shadow]]">
-
-
-<>
-
-
-$list>
diff --git a/core/wiki/tags/EditTemplate.tid b/core/wiki/tags/EditTemplate.tid
index 9a405fb2d..e9c6af98a 100644
--- a/core/wiki/tags/EditTemplate.tid
+++ b/core/wiki/tags/EditTemplate.tid
@@ -1,2 +1,2 @@
title: $:/tags/EditTemplate
-list: [[$:/core/ui/EditTemplate/controls]] [[$:/core/ui/EditTemplate/title]] [[$:/core/ui/EditTemplate/tags]] [[$:/core/ui/EditTemplate/shadowWarning]] [[$:/core/ui/ViewTemplate/classic]] [[$:/core/ui/EditTemplate/body]] [[$:/core/ui/EditTemplate/type]] [[$:/core/ui/EditTemplate/fields]]
+list: [[$:/core/ui/EditTemplate/controls]] [[$:/core/ui/EditTemplate/title]] [[$:/core/ui/EditTemplate/tags]] [[$:/core/ui/EditTemplate/shadow]] [[$:/core/ui/ViewTemplate/classic]] [[$:/core/ui/EditTemplate/body]] [[$:/core/ui/EditTemplate/type]] [[$:/core/ui/EditTemplate/fields]]