Permalink
Browse files

Alt-Enter spawns edit request.

Based on a patch by Wei Hu
  • Loading branch information...
1 parent 46add5f commit 10846032d8d4fd588cf1d0facaad0a0dad9b024b @stsquad committed with Alex Bennee Feb 6, 2010
Showing with 9 additions and 1 deletion.
  1. +1 −0 NEWS
  2. +8 −1 textareas.js
View
@@ -7,6 +7,7 @@ Extension
* Handle textareas that have been "cloned" by Javascript - fixes Google Groups
* Generate user feedback if "edit focused area" failed
* Skip textareas with spell-checking disabled (usually email address boxes)
+* Make Alt-Enter in focused area generate an edit request (patches to make it configurable welcome!)
* Updates to help text in Options
edit-server.el
View
@@ -54,9 +54,16 @@ function textAreaTracker(text)
// The text areas event handlers we attach
this.focusListener = setFocused;
this.dblclickListener = function(){sendTextArea(this);};
+ this.keydownListener = function (e) {
+ // Alt-Enter
+ if (e.altKey && e.keyCode == 13)
+ sendTextArea(this);
+ };
+
this.text.addEventListener('focus', this.focusListener);
this.text.addEventListener('dblclick', this.dblclickListener);
-
+ this.text.addEventListener('keydown', this.keydownListener);
+
// The img
this.image = document.createElement('img');
this.image.style.cursor='pointer';

0 comments on commit 1084603

Please sign in to comment.