diff --git a/IPython/html/static/widgets/js/widget_string.js b/IPython/html/static/widgets/js/widget_string.js index aa5f98e..4fe80d4 100644 --- a/IPython/html/static/widgets/js/widget_string.js +++ b/IPython/html/static/widgets/js/widget_string.js @@ -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);