1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-17 23:34:50 +00:00

Force newly created field names to be lowercase

Fixes #239
This commit is contained in:
Jermolene 2013-11-28 10:35:16 +00:00
parent b77aa3908f
commit b8f15feca4

View File

@ -72,10 +72,13 @@ FieldManglerWidget.prototype.handleRemoveFieldEvent = function(event) {
FieldManglerWidget.prototype.handleAddFieldEvent = function(event) { FieldManglerWidget.prototype.handleAddFieldEvent = function(event) {
var tiddler = this.wiki.getTiddler(this.mangleTitle); var tiddler = this.wiki.getTiddler(this.mangleTitle);
if(tiddler && typeof event.param === "string" && event.param !== "" && !$tw.utils.hop(tiddler.fields,event.param)) { if(tiddler && typeof event.param === "string") {
var addition = {}; var name = event.param.toLowerCase();
addition[event.param] = ""; if(name !== "" && !$tw.utils.hop(tiddler.fields,name)) {
this.wiki.addTiddler(new $tw.Tiddler(tiddler,addition)); var addition = {};
addition[name] = "";
this.wiki.addTiddler(new $tw.Tiddler(tiddler,addition));
}
} }
return true; return true;
}; };