fix key input for windows

This commit is contained in:
Fabian Jakobs 2010-05-13 16:58:33 +02:00
commit 7fa11b08d1
2 changed files with 19 additions and 11 deletions

View file

@ -3,6 +3,12 @@ if (!window.ace)
(function() { (function() {
var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
this.isWin = (os == "win");
this.isMac = (os == "mac");
this.isLinux = (os == "linux");
this.provide = function(namespace) { this.provide = function(namespace) {
var parts = namespace.split("."); var parts = namespace.split(".");
var obj = window; var obj = window;

View file

@ -149,6 +149,7 @@
return callback(e); return callback(e);
}); });
if (ace.isMac) {
self.addListener(el, "keypress", function(e) { self.addListener(el, "keypress", function(e) {
var keyId = e.keyIdentifier || e.keyCode; var keyId = e.keyIdentifier || e.keyCode;
if (lastDown !== keyId) { if (lastDown !== keyId) {
@ -157,5 +158,6 @@
lastDown = null; lastDown = null;
} }
}); });
}
}; };
}).call(ace); }).call(ace);