Fixed: å and Å did not work well on scandinavian keyboards in CPTextView (#3031)

This commit is contained in:
daboe01
2022-04-04 10:23:17 +02:00
committed by Martin Carlberg
parent 24b36cdd95
commit 89c0ab405a
+8 -9
View File
@@ -1053,7 +1053,7 @@ Sets the selection to a range of characters in response to user action.
[[_window platformWindow] _propagateCurrentDOMEvent:YES]; // for the _CPNativeInputManager (necessary at least on FF and chrome)
if (![_CPNativeInputManager isNativeInputFieldActive] && [event charactersIgnoringModifiers].charCodeAt(0) != 229) // filter out 229 because this would be inserted in chrome on each deadkey
if (![_CPNativeInputManager isNativeInputFieldActive] && ![_CPNativeInputManager isDeadKey:event])
[self interpretKeyEvents:[event]];
[_caret setPermanentlyVisible:YES];
@@ -2638,7 +2638,14 @@ var _CPCopyPlaceholder = '-';
{
return _CPNativeInputFieldActive;
}
+ (void)isDeadKey:(CPEvent)event
{
#if PLATFORM(DOM)
return event._DOMEvent && (event._DOMEvent.key == 'Dead' || event._DOMEvent.key == 'Process');
#endif
return NO;
}
+ (void)cancelCurrentNativeInputSession
{
@@ -2713,14 +2720,6 @@ var _CPCopyPlaceholder = '-';
var charCode = _CPNativeInputField.innerHTML.charCodeAt(0);
// å and Å need to be filtered out in keyDown: due to chrome inserting 229 on a deadkey
if (charCode == 229 || charCode == 197)
{
[currentFirstResponder insertText:_CPNativeInputField.innerHTML];
_CPNativeInputField.innerHTML = '';
return;
}
// chrome-trigger: keypressed is omitted for deadkeys
if (!_CPNativeInputFieldActive && _CPNativeInputFieldKeyPressedCalled == NO && _CPNativeInputField.innerHTML.length && _CPNativeInputField.innerHTML != _CPCopyPlaceholder && _CPNativeInputField.innerHTML.length < 3)
{