preview theme in pads with arrow keys in dropdown

pull/1/head
ClemDee 6 years ago
parent 8545ed749a
commit 8fb66daf7b

@ -1737,16 +1737,20 @@ define([
var pressed = ''; var pressed = '';
var to; var to;
$container.keydown(function (e) { $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 (e.which === 38) { // Up
if ($value.length) { if ($value.length) {
$value.mouseleave();
var $prev = $value.prev(); var $prev = $value.prev();
$prev.mouseenter();
setActive($prev); setActive($prev);
} }
} }
if (e.which === 40) { // Down if (e.which === 40) { // Down
if ($value.length) { if ($value.length) {
$value.mouseleave();
var $next = $value.next(); var $next = $value.next();
$next.mouseenter();
setActive($next); setActive($next);
} }
} }
@ -1757,6 +1761,7 @@ define([
} }
} }
if (e.which === 27) { // Esc if (e.which === 27) { // Esc
$value.mouseleave();
hide(); hide();
} }
}); });

@ -231,7 +231,7 @@ define([
}; };
var $block = exp.$language = UIElements.createDropdown(dropdownConfig); var $block = exp.$language = UIElements.createDropdown(dropdownConfig);
$block.find('button').attr('title', Messages.languageButtonTitle); $block.find('button').attr('title', Messages.languageButtonTitle);
var isHovering = false; var isHovering = false;
var $aLanguages = $block.find('a'); var $aLanguages = $block.find('a');
$aLanguages.mouseenter(function () { $aLanguages.mouseenter(function () {
@ -304,7 +304,7 @@ define([
setTheme(theme, $block); setTheme(theme, $block);
Common.setAttribute(themeKey, theme); Common.setAttribute(themeKey, theme);
}); });
if ($drawer) { $drawer.append($block); } if ($drawer) { $drawer.append($block); }
if (cb) { cb(); } if (cb) { cb(); }
}; };

Loading…
Cancel
Save