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() {
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) {
var parts = namespace.split(".");
var obj = window;

View file

@ -3,7 +3,7 @@
var self = this;
this.isIE = ! + "\v1";
this.addListener = function(elem, type, callback) {
if (elem.addEventListener) {
return elem.addEventListener(type, callback, false);
@ -129,14 +129,14 @@
clicks = 0;
}, 600);
}
if (clicks == 3) {
clicks = 0;
callback(e);
}
return self.preventDefault(e);
};
self.addListener(el, "mousedown", listener);
this.isIE && self.addListener(el, "dblclick", listener);
};
@ -149,13 +149,15 @@
return callback(e);
});
self.addListener(el, "keypress", function(e) {
var keyId = e.keyIdentifier || e.keyCode;
if (lastDown !== keyId) {
return callback(e);
} else {
lastDown = null;
}
});
if (ace.isMac) {
self.addListener(el, "keypress", function(e) {
var keyId = e.keyIdentifier || e.keyCode;
if (lastDown !== keyId) {
return callback(e);
} else {
lastDown = null;
}
});
}
};
}).call(ace);