summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McLear <john@mclear.co.uk>2013-02-12 11:06:25 -0800
committerJohn McLear <john@mclear.co.uk>2013-02-12 11:06:25 -0800
commit760bebc429c155d6aae0e3d47c78f8c4a7c694d7 (patch)
tree899f552a67229ac3b2a7e3486d7cc10e6ef3cabc
parentbf6958ad572230c32b21edbdcf2e34a0918478b3 (diff)
parenta37d396577b7ee39e6945334b9cd8f44367a3a69 (diff)
downloadetherpad-lite-760bebc429c155d6aae0e3d47c78f8c4a7c694d7.zip
Merge pull request #1507 from ether/ace2_inner-fix
fix issue where opera was doing stupid things but still an issue w/ doub...
-rw-r--r--src/static/js/ace2_inner.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js
index c48be1bc..8209c9bf 100644
--- a/src/static/js/ace2_inner.js
+++ b/src/static/js/ace2_inner.js
@@ -3561,6 +3561,11 @@ function Ace2Inner(){
var isModKey = ((!charCode) && ((type == "keyup") || (type == "keydown")) && (keyCode == 16 || keyCode == 17 || keyCode == 18 || keyCode == 20 || keyCode == 224 || keyCode == 91));
if (isModKey) return;
+ // If the key is a keypress and the browser is opera and the key is enter, do nothign at all as this fires twice.
+ if (keyCode == 13 && browser.opera && (type == "keypress")){
+ return; // This stops double enters in Opera but double Tabs still show on single tab keypress, adding keyCode == 9 to this doesn't help as the event is fired twice
+ }
+
var specialHandled = false;
var isTypeForSpecialKey = ((browser.msie || browser.safari) ? (type == "keydown") : (type == "keypress"));
var isTypeForCmdKey = ((browser.msie || browser.safari) ? (type == "keydown") : (type == "keypress"));
@@ -4651,10 +4656,7 @@ function Ace2Inner(){
function bindTheEventHandlers()
{
$(document).on("keydown", handleKeyEvent);
- // Hack for Opera to stop it firing twice on events
- if ($.browser.opera){
- $(document).on("keypress", handleKeyEvent);
- }
+ $(document).on("keypress", handleKeyEvent);
$(document).on("keyup", handleKeyEvent);
$(document).on("click", handleClick);
$(root).on("blur", handleBlur);