Fixed keyboard behavior in flash posts
This commit is contained in:
parent
edfaeefb37
commit
111cbff281
1 changed files with 6 additions and 2 deletions
|
@ -1,12 +1,16 @@
|
||||||
var App = App || {};
|
var App = App || {};
|
||||||
|
|
||||||
App.Keyboard = function(mousetrap) {
|
App.Keyboard = function(jQuery, mousetrap) {
|
||||||
|
|
||||||
var oldStopCallback = mousetrap.stopCallback;
|
var oldStopCallback = mousetrap.stopCallback;
|
||||||
mousetrap.stopCallback = function(e, element, combo, sequence) {
|
mousetrap.stopCallback = function(e, element, combo, sequence) {
|
||||||
if (combo.indexOf('ctrl') !== -1) {
|
if (combo.indexOf('ctrl') !== -1) {
|
||||||
return false;
|
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);
|
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);
|
||||||
|
|
Loading…
Reference in a new issue