fix key input for windows
This commit is contained in:
parent
869e37119a
commit
7fa11b08d1
2 changed files with 19 additions and 11 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
Loading…
Add table
Add a link
Reference in a new issue