Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebView for Authentication does not accept key commands. #3

Open
theladyjaye opened this issue Jul 6, 2014 · 1 comment
Open

WebView for Authentication does not accept key commands. #3

theladyjaye opened this issue Jul 6, 2014 · 1 comment

Comments

@theladyjaye
Copy link

Sample implementation to forward copy/paste

#import <WebKit/WebKit.h>
@interface DSYWebView : WebView
@end

@implementation DSYWebView

- (void)keyDown:(NSEvent *)theEvent
{
    // no op - kills the beep;
}

- (BOOL)performKeyEquivalent:(NSEvent *)theEvent
{
    NSString * chars = [theEvent characters];
    BOOL status = NO;

    if ([theEvent modifierFlags] & NSCommandKeyMask){

        if ([chars isEqualTo:@"a"]){
            [self selectAll:nil];
            status = YES;
        }

        if ([chars isEqualTo:@"c"]){
            [self copy:nil];
            status = YES;
        }

        if ([chars isEqualTo:@"v"]){
            [self paste:nil];
            status = YES;
        }

        if ([chars isEqualTo:@"x"]){
            [self cut:nil];
            status = YES;
        }
    }
    return status;
}
@bjtitus
Copy link

bjtitus commented Nov 6, 2014

@aventurella Thanks for this suggestion. I've added it to my branch here: https://github.com/bjtitus/mac-miniplayer

If you have any more suggestions, file an issue with me and I'll try to incorporate them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants