diff --git a/www/common/sframe-common-codemirror.js b/www/common/sframe-common-codemirror.js index a88059edc..3636e5b6c 100644 --- a/www/common/sframe-common-codemirror.js +++ b/www/common/sframe-common-codemirror.js @@ -231,7 +231,20 @@ define([ }; var $block = exp.$language = UIElements.createDropdown(dropdownConfig); $block.find('button').attr('title', Messages.languageButtonTitle); - $block.find('a').click(function () { + + var isHovering = false; + var $aLanguages = $block.find('a'); + $aLanguages.mouseenter(function () { + isHovering = true; + setMode($(this).attr('data-value')); + }); + $aLanguages.mouseleave(function () { + if (isHovering) { + setMode($block.find(".cp-dropdown-element-active").attr('data-value')); + } + }); + $aLanguages.click(function () { + isHovering = false; setMode($(this).attr('data-value'), onModeChanged); onLocal(); });