madrobby/keymaster

Class selector as a filter

Opened this issue · 1 comments

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.

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;
}