2011-01-24 19:38:52 +00:00
|
|
|
var StringController = function() {
|
2011-01-24 20:11:19 +00:00
|
|
|
|
2011-01-24 19:38:52 +00:00
|
|
|
this.type = "string";
|
2011-01-24 20:11:19 +00:00
|
|
|
|
|
|
|
var _this = this;
|
|
|
|
|
2011-01-24 19:38:52 +00:00
|
|
|
Controller.apply(this, arguments);
|
2011-01-24 20:11:19 +00:00
|
|
|
|
2011-01-24 19:38:52 +00:00
|
|
|
var input = document.createElement('input');
|
2011-01-24 20:11:19 +00:00
|
|
|
|
2011-01-24 21:09:55 +00:00
|
|
|
var initialValue = this.getValue();
|
|
|
|
|
|
|
|
input.setAttribute('value', initialValue);
|
2011-01-24 22:08:48 +00:00
|
|
|
input.setAttribute('spellcheck', 'false');
|
2011-01-24 20:28:13 +00:00
|
|
|
this.domElement.addEventListener('mouseup', function() {
|
2011-01-24 20:11:19 +00:00
|
|
|
input.focus();
|
2011-01-24 20:28:13 +00:00
|
|
|
input.select();
|
2011-01-24 20:11:19 +00:00
|
|
|
}, false);
|
|
|
|
|
|
|
|
input.addEventListener('keyup', function() {
|
2011-01-24 21:09:55 +00:00
|
|
|
_this.setValue(input.value);
|
2011-01-24 20:11:19 +00:00
|
|
|
}, false);
|
|
|
|
|
2011-01-24 21:09:55 +00:00
|
|
|
this.domElement.appendChild(input);
|
2011-01-24 19:38:52 +00:00
|
|
|
};
|
|
|
|
StringController.prototype = new Controller();
|
|
|
|
StringController.prototype.constructor = StringController;
|