diff --git a/CHANGES.md b/CHANGES.md index 409c8185d69929d2598420237bf981ce49a70150..3aca060b2d11d505f01ce64977e3c1ae70df3603 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,10 @@ moodle-theme_boost_campus Changes ------- +### Unreleased + +* 2017-10-16 - Improved catching shortcuts feature again to prevent catching when editable content is focused. + ### Release v3.2-r4 * 2017-09-25 - Improved catching shortcuts feature to prevent the catching when form elements are focused. diff --git a/amd/build/catchshortcuts.min.js b/amd/build/catchshortcuts.min.js index 24aa6e99995eff5a4a623a864dfa45f37a24a6bd..3ff0a0282ac17320349b80cead07cb613b160753 100644 --- a/amd/build/catchshortcuts.min.js +++ b/amd/build/catchshortcuts.min.js @@ -1 +1 @@ -define(["jquery"],function(a){"use strict";function b(b){"end"==b&&a(document).keydown(function(a){35==a.keyCode&&1!=d()&&c(a)}),navigator.appVersion.indexOf("Mac")!=-1&&"cmdarrowdown"==b&&a(document).keydown(function(a){40==a.keyCode&&a.metaKey&&1!=d()&&c(a)}),navigator.appVersion.indexOf("Win")!=-1&&"ctrlarrowdown"==b&&a(document).keydown(function(a){40==a.keyCode&&a.ctrlKey&&1!=d()&&c(a)})}function c(b){b.preventDefault(),a("html, body").animate({scrollTop:a("#page-footer").offset().top-a(window).height()+50},500)}function d(){var a=document.activeElement.tagName,b=!1;return"INPUT"!=a&&"TEXTAREA"!=a||(b=!0),b}return{init:function(a){for(var c=0,d=a.length;c<d;c++)b(a[c])}}}); \ No newline at end of file +define(["jquery"],function(a){"use strict";function b(b){"end"==b&&a(document).keydown(function(a){35==a.keyCode&&1!=d()&&c(a)}),navigator.appVersion.indexOf("Mac")!=-1&&"cmdarrowdown"==b&&a(document).keydown(function(a){40==a.keyCode&&a.metaKey&&1!=d()&&c(a)}),navigator.appVersion.indexOf("Win")!=-1&&"ctrlarrowdown"==b&&a(document).keydown(function(a){40==a.keyCode&&a.ctrlKey&&1!=d()&&c(a)})}function c(b){b.preventDefault(),a("html, body").animate({scrollTop:a("#page-footer").offset().top-a(window).height()+50},500)}function d(){var a=document.activeElement,b=!1;return"INPUT"!=a.tagName&&"TEXTAREA"!=a.tagName&&1!=a.isContentEditable||(b=!0),b}return{init:function(a){for(var c=0,d=a.length;c<d;c++)b(a[c])}}}); \ No newline at end of file diff --git a/amd/src/catchshortcuts.js b/amd/src/catchshortcuts.js index c39543ef5416bd6e82032b93e00eb0734033465a..604cc4e94998c9343a3fd0ed8e181000dd142e21 100644 --- a/amd/src/catchshortcuts.js +++ b/amd/src/catchshortcuts.js @@ -91,10 +91,10 @@ define(['jquery'], function($) { */ function checkForActiveFormElement() { // Get the active Element for the current page. - var activeElement = document.activeElement.tagName; + var activeElement = document.activeElement; var returnvalue = false; - // Check if the given active element is an input field or a textarea. - if (activeElement == 'INPUT' || activeElement == 'TEXTAREA') { + // Check if the given active element is type of input field, textarea or editable content. + if (activeElement.tagName == 'INPUT' || activeElement.tagName == 'TEXTAREA' || activeElement.isContentEditable == true) { returnvalue = true; } return returnvalue;