From 111cbff28123a858926cdbf831536cb29f906933 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Sun, 26 Oct 2014 22:51:48 +0100 Subject: [PATCH] Fixed keyboard behavior in flash posts --- public_html/js/Keyboard.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public_html/js/Keyboard.js b/public_html/js/Keyboard.js index bcf209c6..4a38da28 100644 --- a/public_html/js/Keyboard.js +++ b/public_html/js/Keyboard.js @@ -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);