mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-11 19:17:07 +00:00
improved FF deadkey detection
This commit is contained in:
1 parent
f2d5dee49e
commit
631352e1ef
1 file changed
+8
@@ -2245,6 +2245,7 @@ var CPTextViewAllowsUndoKey = @"CPTextViewAllowsUndoKey",
|
||||
|
||||
var _CPNativeInputField,
|
||||
_CPNativeInputFieldLastValue,
|
||||
_CPNativeInputFieldKeyDownCalled,
|
||||
_CPNativeInputFieldKeyUpCalled,
|
||||
_CPNativeInputFieldKeyPressedCalled,
|
||||
_CPNativeInputFieldActive,
|
||||
@@ -2372,6 +2373,11 @@ var _CPCopyPlaceholder = '-';
|
||||
|
||||
_CPNativeInputField.addEventListener("keydown", function(e)
|
||||
{
|
||||
// this protects from heavy typing
|
||||
if (CPBrowserIsEngine(CPGeckoBrowserEngine) && _CPNativeInputFieldKeyDownCalled)
|
||||
return true;
|
||||
|
||||
_CPNativeInputFieldKeyDownCalled = YES;
|
||||
_CPNativeInputFieldKeyUpCalled = NO;
|
||||
_CPNativeInputFieldKeyPressedCalled = NO;
|
||||
var currentFirstResponder = [[CPApp keyWindow] firstResponder];
|
||||
@@ -2382,6 +2388,8 @@ var _CPCopyPlaceholder = '-';
|
||||
// FF-trigger: here the best way to detect a dead key is the missing keyup event
|
||||
if (CPBrowserIsEngine(CPGeckoBrowserEngine))
|
||||
setTimeout(function(){
|
||||
_CPNativeInputFieldKeyDownCalled = NO;
|
||||
|
||||
if (!_CPNativeInputFieldActive && _CPNativeInputFieldKeyUpCalled == NO && _CPNativeInputField.innerHTML.length && _CPNativeInputField.innerHTML != _CPCopyPlaceholder && _CPNativeInputField.innerHTML.length < 3 && !e.repeat)
|
||||
{
|
||||
_CPNativeInputFieldActive = YES;
|
||||
|
||||
Reference in new issue
Block a user