1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-24 00:50:28 +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) {
var tiddler = this.wiki.getTiddler(this.mangleTitle);
if(tiddler && typeof event.param === "string" && event.param !== "" && !$tw.utils.hop(tiddler.fields,event.param)) {
var addition = {};
addition[event.param] = "";
this.wiki.addTiddler(new $tw.Tiddler(tiddler,addition));
if(tiddler && typeof event.param === "string") {
var name = event.param.toLowerCase();
if(name !== "" && !$tw.utils.hop(tiddler.fields,name)) {
var addition = {};
addition[name] = "";
this.wiki.addTiddler(new $tw.Tiddler(tiddler,addition));
}
}
return true;
};