1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 02:19:55 +00:00

add rows attribute to edittext, plus docs

This commit is contained in:
Tobias Beer 2015-12-24 15:40:00 +01:00
parent 3a426dfd2a
commit 456e7abc5d
2 changed files with 12 additions and 6 deletions

View File

@ -52,6 +52,9 @@ EditTextWidget.prototype.render = function(parent,nextSibling) {
if(this.editSize) {
domNode.setAttribute("size",this.editSize);
}
if(this.editRows) {
domNode.setAttribute("rows",this.editRows);
}
// Assign classes
if(this.editClass) {
domNode.className = this.editClass;
@ -79,7 +82,7 @@ EditTextWidget.prototype.render = function(parent,nextSibling) {
if(this.editFocus === "true") {
if(domNode.focus && domNode.select) {
domNode.focus();
domNode.select();
domNode.select();
}
}
};
@ -148,6 +151,7 @@ EditTextWidget.prototype.execute = function() {
this.editClass = this.getAttribute("class");
this.editPlaceholder = this.getAttribute("placeholder");
this.editSize = this.getAttribute("size");
this.editRows = this.getAttribute("rows");
this.editAutoHeight = this.getAttribute("autoHeight","yes") === "yes";
this.editMinHeight = this.getAttribute("minHeight",DEFAULT_MIN_TEXT_AREA_HEIGHT);
this.editFocusPopup = this.getAttribute("focusPopup");
@ -178,7 +182,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
EditTextWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes();
// Completely rerender if any of our attributes have changed
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup) {
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows) {
this.refreshSelf();
return true;
} else if(changedTiddlers[this.editTitle]) {

View File

@ -1,8 +1,9 @@
title: EditTextWidget
created: 201310241419
modified: 20150220162131000
tags: Widgets
caption: edit-text
created: 20131024141900000
modified: 20151224143914772
tags: Widgets
title: EditTextWidget
type: text/vnd.tiddlywiki
! Introduction
@ -28,6 +29,7 @@ The content of the `<$edit-text>` widget is ignored.
|size |The size of the input field (in characters) |
|autoHeight |Either "yes" or "no" to specify whether to automatically resize `textarea` editors to fit their content (defaults to "yes") |
|minHeight |Minimum height for automatically resized `textarea` editors, specified in CSS length units such as "px", "em" or "%" |
|rows|Sets the rows attribute of a generated textarea |
! Notes