From 0be6bf84d13cdcab50808edebeafacea4f919c09 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Thu, 13 Jun 2013 09:16:07 +0100 Subject: [PATCH] Extend fieldmodules to include an "editType" field This will allow us to provide the right HTML5 input element for things like colours and dates --- boot/boot.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/boot/boot.js b/boot/boot.js index a97024162..719c9177a 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -606,7 +606,7 @@ $tw.Tiddler = function(/* [fields,] fields */) { } else { // Parse the field with the associated field module (if any) var fieldModule = $tw.Tiddler.fieldModules[t]; - if(fieldModule) { + if(fieldModule && fieldModule.parse) { this.fields[t] = fieldModule.parse.call(this,src[t]); } else { this.fields[t] = src[t]; @@ -633,6 +633,10 @@ $tw.modules.define("$:/boot/tiddlerfields/created","tiddlerfield",{ parse: $tw.utils.parseDate, stringify: $tw.utils.stringifyDate }); +$tw.modules.define("$:/boot/tiddlerfields/color","tiddlerfield",{ + name: "color", + editType: "color" +}); $tw.modules.define("$:/boot/tiddlerfields/tags","tiddlerfield",{ name: "tags", parse: $tw.utils.parseStringArray,