Fix key repeat workaround for Safari.
Typing "(" now works in Safari
This commit is contained in:
parent
7ddb4d728c
commit
53ea2aeb17
2 changed files with 32 additions and 30 deletions
|
|
@ -17,6 +17,7 @@ require.def("ace/lib/core", function() {
|
||||||
core.isMac = (os == "mac");
|
core.isMac = (os == "mac");
|
||||||
core.isLinux = (os == "linux");
|
core.isLinux = (os == "linux");
|
||||||
core.isIE = ! + "\v1";
|
core.isIE = ! + "\v1";
|
||||||
|
core.isGecko = window.controllers && window.navigator.product === "Gecko";
|
||||||
|
|
||||||
core.provide = function(namespace) {
|
core.provide = function(namespace) {
|
||||||
var parts = namespace.split(".");
|
var parts = namespace.split(".");
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,8 @@ require.def("ace/lib/event", ["ace/lib/core"], function(core) {
|
||||||
return callback(e);
|
return callback(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (core.isMac) {
|
// repeated keys are fired as keypress and not keydown events
|
||||||
|
if (core.isMac && core.isGecko) {
|
||||||
event.addListener(el, "keypress", function(e) {
|
event.addListener(el, "keypress", function(e) {
|
||||||
var keyId = e.keyIdentifier || e.keyCode;
|
var keyId = e.keyIdentifier || e.keyCode;
|
||||||
if (lastDown !== keyId) {
|
if (lastDown !== keyId) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue