diff --git a/www/common/sframe-common-codemirror.js b/www/common/sframe-common-codemirror.js index 8fd886fec..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(); }); @@ -272,12 +285,26 @@ define([ setTheme(lastTheme, $block); - $block.find('a').click(function () { + var isHovering = false; + var $aThemes = $block.find('a'); + $aThemes.mouseenter(function () { + isHovering = true; + var theme = $(this).attr('data-value'); + setTheme(theme, $block); + }); + $aThemes.mouseleave(function () { + if (isHovering) { + setTheme(lastTheme, $block); + Common.setAttribute(themeKey, lastTheme); + } + }); + $aThemes.click(function () { + isHovering = false; var theme = $(this).attr('data-value'); setTheme(theme, $block); Common.setAttribute(themeKey, theme); }); - + if ($drawer) { $drawer.append($block); } if (cb) { cb(); } }; diff --git a/www/slide/inner.js b/www/slide/inner.js index 6da8072c3..1be2e5f3b 100644 --- a/www/slide/inner.js +++ b/www/slide/inner.js @@ -458,6 +458,7 @@ define([ mkHelpMenu(framework); CodeMirror.mkIndentSettings(framework._.cpNfInner.metadataMgr); + CodeMirror.init(framework.localChange, framework._.title, framework._.toolbar); CodeMirror.configureTheme(common); framework.onContentUpdate(function (newContent) {