mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-04 16:12:58 +00:00
Merge pull request #3177 from daboe01/menushortcut-textviewfix
fixed: keystrokes from menu shortcuts are inserted into textviews
This commit is contained in:
2 files changed
+9
-6
No files matched your search
@@ -1075,6 +1075,7 @@ var _CPMenuBarVisible = NO,
|
||||
if (self === [CPApp mainMenu])
|
||||
[self _flashItemAtIndex:index];
|
||||
|
||||
anEvent._isKeyEquivalent = YES; // prevent the menu keystroke from beeing inserted into textview
|
||||
[self performActionForItemAtIndex:index];
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1867,7 +1867,7 @@ Sets the selection to a range of characters in response to user action.
|
||||
}
|
||||
else
|
||||
{
|
||||
[_typingAttributes setObject:[sender selectedFont] forKey:CPFontAttributeName];
|
||||
[_typingAttributes setObject:[sender convertFont:oldFont] forKey:CPFontAttributeName];
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2754,12 +2754,14 @@ var _CPCopyPlaceholder = '-';
|
||||
var currentFirstResponder = [[CPApp keyWindow] firstResponder];
|
||||
|
||||
if (currentFirstResponder && [currentFirstResponder respondsToSelector:@selector(insertText:)])
|
||||
// setTimeout to prevent flickering
|
||||
setTimeout(function(){
|
||||
[currentFirstResponder insertText:textToInsert]
|
||||
}, 20);
|
||||
var event = [CPApp currentEvent];
|
||||
|
||||
// CRUCIAL: Clear the field immediately after grabbing its content.
|
||||
if (!event._isKeyEquivalent)
|
||||
setTimeout(function(){
|
||||
[currentFirstResponder insertText:textToInsert]
|
||||
}, 20);
|
||||
|
||||
// Clear the field immediately after grabbing its content.
|
||||
_CPNativeInputField.innerHTML = '';
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user