Show More
@@ -141,6 +141,16 b' define(["widgets/js/widget"], function(WidgetManager){' | |||||
141 | .appendTo(this.$el); |
|
141 | .appendTo(this.$el); | |
142 | this.$el_to_style = this.$textbox; // Set default element to style |
|
142 | this.$el_to_style = this.$textbox; // Set default element to style | |
143 | this.update(); // Set defaults. |
|
143 | this.update(); // Set defaults. | |
|
144 | this.model.on('change:placeholder', function(model, value, options) { | |||
|
145 | this.update_placeholder(value); | |||
|
146 | }, this); | |||
|
147 | }, | |||
|
148 | ||||
|
149 | update_placeholder: function(value) { | |||
|
150 | if (!value) { | |||
|
151 | value = this.model.get('placeholder'); | |||
|
152 | } | |||
|
153 | this.$textbox.attr('placeholder', value); | |||
144 | }, |
|
154 | }, | |
145 |
|
155 | |||
146 | update: function(options){ |
|
156 | update: function(options){ |
@@ -23,6 +23,7 b' class _StringWidget(DOMWidget):' | |||||
23 | value = Unicode(help="String value", sync=True) |
|
23 | value = Unicode(help="String value", sync=True) | |
24 | disabled = Bool(False, help="Enable or disable user changes", sync=True) |
|
24 | disabled = Bool(False, help="Enable or disable user changes", sync=True) | |
25 | description = Unicode(help="Description of the value this widget represents", sync=True) |
|
25 | description = Unicode(help="Description of the value this widget represents", sync=True) | |
|
26 | placeholder = Unicode("", help="Placeholder text to display when nothing has been typed", sync=True) | |||
26 |
|
27 | |||
27 |
|
28 | |||
28 | class HTMLWidget(_StringWidget): |
|
29 | class HTMLWidget(_StringWidget): |
General Comments 0
You need to be logged in to leave comments.
Login now