From 8fb66daf7baab15de4d8ccf5e879d42087172e32 Mon Sep 17 00:00:00 2001 From: ClemDee Date: Mon, 24 Jun 2019 10:58:32 +0200 Subject: [PATCH] preview theme in pads with arrow keys in dropdown --- www/common/common-ui-elements.js | 7 ++++++- www/common/sframe-common-codemirror.js | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index c6668e41f..70da31523 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1737,16 +1737,20 @@ define([ var pressed = ''; var to; $container.keydown(function (e) { - var $value = $innerblock.find('[data-value].cp-dropdown-element-active'); + var $value = $innerblock.find('[data-value].cp-dropdown-element-active:visible'); if (e.which === 38) { // Up if ($value.length) { + $value.mouseleave(); var $prev = $value.prev(); + $prev.mouseenter(); setActive($prev); } } if (e.which === 40) { // Down if ($value.length) { + $value.mouseleave(); var $next = $value.next(); + $next.mouseenter(); setActive($next); } } @@ -1757,6 +1761,7 @@ define([ } } if (e.which === 27) { // Esc + $value.mouseleave(); hide(); } }); diff --git a/www/common/sframe-common-codemirror.js b/www/common/sframe-common-codemirror.js index 3636e5b6c..ebf7d752e 100644 --- a/www/common/sframe-common-codemirror.js +++ b/www/common/sframe-common-codemirror.js @@ -231,7 +231,7 @@ define([ }; var $block = exp.$language = UIElements.createDropdown(dropdownConfig); $block.find('button').attr('title', Messages.languageButtonTitle); - + var isHovering = false; var $aLanguages = $block.find('a'); $aLanguages.mouseenter(function () { @@ -304,7 +304,7 @@ define([ setTheme(theme, $block); Common.setAttribute(themeKey, theme); }); - + if ($drawer) { $drawer.append($block); } if (cb) { cb(); } };