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

Class selector as a filter #144

Open
ghost opened this issue Jan 14, 2015 · 1 comment
Open

Class selector as a filter #144

ghost opened this issue Jan 14, 2015 · 1 comment

Comments

@ghost
Copy link

ghost commented Jan 14, 2015

Is it possible to use class selector as a filter?

$('.a, .b, .c') - shortcut works.
$('.d, .e, .f') - shortcut doesn't work.

I need to disable these shortcuts to the document: 'ctrl+s, ctrl+a, ctrl+b, ctrl+i, ctrl+u', but for the contenteditable only 'ctrl+s, ctrl+b, ctrl+i, ctrl+u'.

Thanks in advance.

@ghost
Copy link
Author

ghost commented Jan 15, 2015

key('ctrl+s, ctrl+a, ctrl+b, ctrl+i, ctrl+u', 'document', function(event) {
    event.preventDefault();
});
key('ctrl+s, ctrl+b, ctrl+i, ctrl+u', 'editable', function(event) {
    event.preventDefault();
});
key.filter = function(event) {
    var contentEditable = (event.target || event.srcElement).isContentEditable;
    key.setScope(contentEditable ? 'editable' : 'document');
    return true;
}

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

0 participants