this.textarea.style.height = (-18 + sums([this.elem], [this.title, this.buttons], "offsetHeight")) + "px";
this.textarea.style.width = (-16 + sums([this.elem], [ ], "offsetWidth")) + "px";
+ var textarea = this;
+
+ this.keyDownListener_ = function(event) {
+ if(event.keyCode == 13) { // enter / return
+ textarea.hide();
+ }
+ if(event.keyCode == 27) { // esc
+ textarea.hide();
+ }
+ }
+
+ Dygraph.addEvent(document, "keydown", this.keyDownListener_);
this.reposition();
window.addEventListener('resize', this.reposition, false);
document.documentElement.addEventListener('onscroll', this.reposition);
}
TextArea.prototype.hide = function() {
+ Dygraph.removeEvent(document, "keypress", this.keyDownListener_);
+ this.keyDownListener_ = null;
this.elem.style.display = "none";
this.background.style.display = "none";
window.removeEventListener("resize", this.reposition);