From 9c2bb8469e511dedb664ddb28ab476eb805c5000 Mon Sep 17 00:00:00 2001 From: Sebastiaan Kloos Date: Fri, 23 Nov 2018 08:09:45 +0100 Subject: [PATCH] Minor documentation updates to input.hotkey.js (#2721) Credit to @SebastiaanKloos --- modules/system/assets/ui/docs/input-hotkey.md | 8 ++++++++ modules/system/assets/ui/js/input.hotkey.js | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/system/assets/ui/docs/input-hotkey.md b/modules/system/assets/ui/docs/input-hotkey.md index 7bf4a3e83..ccd5c3f87 100644 --- a/modules/system/assets/ui/docs/input-hotkey.md +++ b/modules/system/assets/ui/docs/input-hotkey.md @@ -18,4 +18,12 @@ Allows keyboard shortcuts (hotkeys) to be bound to an element's click event. Press "Shift + R" on your keyboard +## Javascript API +If you use a selector other than a button or a link, you will need to add the `hotkeyVisible` property to the hotkey config. + + $('html').hotKey({ + hotkey: 'ctrl+s, cmd+s', + hotkeyVisible: false, + callback: doSomething + }); diff --git a/modules/system/assets/ui/js/input.hotkey.js b/modules/system/assets/ui/js/input.hotkey.js index b78d6729a..353b85807 100644 --- a/modules/system/assets/ui/js/input.hotkey.js +++ b/modules/system/assets/ui/js/input.hotkey.js @@ -1,12 +1,12 @@ /* * Hot key binding. - * + * * Data attributes: * - data-hotkey="ctrl+s, cmd+s" - enables the hotkey plugin * * JavaScript API: * - * $('html').hotKey({ hotkey: 'ctrl+s, cmd+s', callback: doSomething); + * $('html').hotKey({ hotkey: 'ctrl+s, cmd+s', hotkeyVisible: false, callback: doSomething }); */ +function ($) { "use strict"; @@ -209,9 +209,9 @@ // HOTKEY DATA-API // ============== - + $(document).render(function() { $('[data-hotkey]').hotKey() }) -}(window.jQuery); \ No newline at end of file +}(window.jQuery);