1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-05 03:33:27 +00:00

Only set placeholders when field has no data (fixes #317)

This commit is contained in:
David Jade 2013-12-29 17:18:00 -08:00
parent b6f2f1e1aa
commit 3b114371d0

View File

@ -37,11 +37,12 @@ EditTextWidget.prototype.render = function(parent,nextSibling) {
// Execute our logic // Execute our logic
this.execute(); this.execute();
// Create our element // Create our element
var editInfo = this.getEditInfo();
var domNode = this.document.createElement(this.editTag); var domNode = this.document.createElement(this.editTag);
if(this.editType) { if(this.editType) {
domNode.setAttribute("type",this.editType); domNode.setAttribute("type",this.editType);
} }
if(this.editPlaceholder) { if(editInfo.value === "" && this.editPlaceholder) {
domNode.setAttribute("placeholder",this.editPlaceholder); domNode.setAttribute("placeholder",this.editPlaceholder);
} }
// Assign classes // Assign classes
@ -49,7 +50,6 @@ EditTextWidget.prototype.render = function(parent,nextSibling) {
domNode.className = this.editClass; domNode.className = this.editClass;
} }
// Set the text // Set the text
var editInfo = this.getEditInfo();
if(this.editTag === "textarea") { if(this.editTag === "textarea") {
domNode.appendChild(this.document.createTextNode(editInfo.value)); domNode.appendChild(this.document.createTextNode(editInfo.value));
} else { } else {