mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-30 05:19:57 +00:00
Add input type handling to the texteditor
This allows us to customise the input element used for each field type. The only one implemented at the moment is color, which currently only works on Chrome
This commit is contained in:
parent
8471a2217a
commit
cb34ef20ad
@ -56,7 +56,17 @@ TextEditor.prototype.render = function() {
|
|||||||
type: "element",
|
type: "element",
|
||||||
attributes: {}
|
attributes: {}
|
||||||
};
|
};
|
||||||
var type = this.editWidget.renderer.getAttribute("type",this.fieldName === "text" ? "textarea" : "input");
|
// Get the edit type associated with this field
|
||||||
|
var type = "input";
|
||||||
|
if(this.fieldName === "text") {
|
||||||
|
type = "textarea";
|
||||||
|
} else {
|
||||||
|
var fieldModule = $tw.Tiddler.fieldModules[this.fieldName];
|
||||||
|
if(fieldModule && fieldModule.editType) {
|
||||||
|
type = fieldModule.editType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var type = this.editWidget.renderer.getAttribute("type",type);
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case "textarea":
|
case "textarea":
|
||||||
node.tag = "textarea";
|
node.tag = "textarea";
|
||||||
@ -65,6 +75,11 @@ TextEditor.prototype.render = function() {
|
|||||||
text: editInfo.value
|
text: editInfo.value
|
||||||
}];
|
}];
|
||||||
break;
|
break;
|
||||||
|
case "color":
|
||||||
|
node.tag = "input";
|
||||||
|
node.attributes.type = {type: "string", value: "color"};
|
||||||
|
node.attributes.value = {type: "string", value: editInfo.value};
|
||||||
|
break;
|
||||||
case "search":
|
case "search":
|
||||||
node.tag = "input";
|
node.tag = "input";
|
||||||
node.attributes.type = {type: "string", value: "search"};
|
node.attributes.type = {type: "string", value: "search"};
|
||||||
|
Loading…
Reference in New Issue
Block a user