1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-28 11:00:27 +00:00

Extend fieldmodules to include an "editType" field

This will allow us to provide the right HTML5 input element for things
like colours and dates
This commit is contained in:
Jeremy Ruston 2013-06-13 09:16:07 +01:00
parent f285f850d7
commit 0be6bf84d1

View File

@ -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,