diff --git a/demo/kitchen-sink/demo.js b/demo/kitchen-sink/demo.js index bf22cb4c..0ef1610f 100644 --- a/demo/kitchen-sink/demo.js +++ b/demo/kitchen-sink/demo.js @@ -390,10 +390,28 @@ function saveOption(el, val) { } } +themeEl.addEventListener("mouseover", function(e){ + this.desiredValue = e.target.value; + if (!this.$timer) + this.$timer = setTimeout(this.updateTheme); +}) + +themeEl.addEventListener("mouseout", function(e){ + this.desiredValue = null; + if (!this.$timer) + this.$timer = setTimeout(this.updateTheme, 20); +}) + +themeEl.updateTheme = function(){ + env.split.setTheme(themeEl.desiredValue || themeEl.selectedValue); + themeEl.$timer = null; +} + bindDropdown("theme", function(value) { if (!value) return; env.editor.setTheme(value); + themeEl.selectedValue = value; }); bindDropdown("keybinding", function(value) {