From efdae19f0cda9b3579fa2fdbb716be3cb237a453 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 19 Jan 2017 12:13:57 +0100 Subject: [PATCH 1/4] Update the lists in the code and slide toolbars to use the new dropdown --- customize.dist/main.css | 2 + customize.dist/src/less/dropdown.less | 2 + customize.dist/toolbar.css | 2 + www/code/main.js | 95 +++++++++++++++------------ www/slide/main.js | 58 ++++++++-------- 5 files changed, 87 insertions(+), 72 deletions(-) diff --git a/customize.dist/main.css b/customize.dist/main.css index 157346865..0abf7e6bf 100644 --- a/customize.dist/main.css +++ b/customize.dist/main.css @@ -347,6 +347,8 @@ min-width: 160px; box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.2); z-index: 1000; + max-height: 300px; + overflow-y: auto; } .dropdown-bar .dropdown-bar-content.left { right: 0; diff --git a/customize.dist/src/less/dropdown.less b/customize.dist/src/less/dropdown.less index d45749fa3..80fb08bff 100644 --- a/customize.dist/src/less/dropdown.less +++ b/customize.dist/src/less/dropdown.less @@ -29,6 +29,8 @@ min-width: 160px; box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.2); z-index: 1000; + max-height: 300px; + overflow-y: auto; &.left { right: 0; diff --git a/customize.dist/toolbar.css b/customize.dist/toolbar.css index ab02c7b41..a169fb4ce 100644 --- a/customize.dist/toolbar.css +++ b/customize.dist/toolbar.css @@ -16,6 +16,8 @@ min-width: 160px; box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.2); z-index: 1000; + max-height: 300px; + overflow-y: auto; } .dropdown-bar .dropdown-bar-content.left { right: 0; diff --git a/www/code/main.js b/www/code/main.js index 47ac9d919..3af11316d 100644 --- a/www/code/main.js +++ b/www/code/main.js @@ -77,7 +77,10 @@ define([ } CodeMirror.autoLoadMode(editor, mode); editor.setOption('mode', mode); - if ($select && $select.val) { $select.val(mode); } + if ($select) { + var name = $select.find('a[data-value="' + mode + '"]').text() || 'Mode'; + $select.find('.buttonTitle').text(name); + } }; editor.setValue(Messages.codeInitialState); // HERE @@ -107,7 +110,7 @@ define([ } editor.setOption('theme', theme); } - if ($select && $select.val) { $select.val(theme || 'default'); } + if ($select) { $select.find('.buttonTitle').text(theme || 'Theme'); } }; }()); @@ -441,58 +444,68 @@ define([ var configureLanguage = function (cb) { // FIXME this is async so make it happen as early as possible - - /* Let the user select different syntax highlighting modes */ - var $language = module.$language = $('', { - title: 'color theme', - id: 'display-theme', - 'class': 'rightside-element' - }); - Themes.forEach(function (o) { - $themeDropdown.append($('