Add placeholder to textarea as well as text

This commit is contained in:
Jessica B. Hamrick 2014-04-17 11:06:11 -04:00
parent 1f8253898c
commit 95fc7167dd

View File

@ -71,6 +71,11 @@ define(["widgets/js/widget"], function(WidgetManager){
this.update(); // Set defaults.
this.model.on('msg:custom', $.proxy(this._handle_textarea_msg, this));
this.model.on('change:placeholder', function(model, value, options) {
this.update_placeholder(value);
}, this);
this.update_placeholder();
},
_handle_textarea_msg: function (content){
@ -80,6 +85,13 @@ define(["widgets/js/widget"], function(WidgetManager){
}
},
update_placeholder: function(value) {
if (!value) {
value = this.model.get('placeholder');
}
this.$textbox.attr('placeholder', value);
},
scroll_to_bottom: function (){
// Scroll the text-area view to the bottom.
this.$textbox.scrollTop(this.$textbox[0].scrollHeight);