Fixed keyboard behavior in flash posts

This commit is contained in:
Marcin Kurczewski 2014-10-26 22:51:48 +01:00
parent edfaeefb37
commit 111cbff281

View file

@ -1,12 +1,16 @@
var App = App || {};
App.Keyboard = function(mousetrap) {
App.Keyboard = function(jQuery, mousetrap) {
var oldStopCallback = mousetrap.stopCallback;
mousetrap.stopCallback = function(e, element, combo, sequence) {
if (combo.indexOf('ctrl') !== -1) {
return false;
}
var $focused = jQuery(':focus').eq(0);
if ($focused.length && $focused.prop('tagName').match(/embed|object/i)) {
return true;
}
return oldStopCallback.apply(mousetrap, arguments);
};
@ -37,4 +41,4 @@ App.Keyboard = function(mousetrap) {
};
};
App.DI.register('keyboard', ['mousetrap'], App.Keyboard);
App.DI.register('keyboard', ['jQuery', 'mousetrap'], App.Keyboard);