set mode in the editor, not just the dropdown

pull/1/head
ansuz 8 years ago
parent 446266a79b
commit 846d1135b9

@ -332,17 +332,22 @@ define([
}).join('\n') + }).join('\n') +
'</select>'; '</select>';
setMode(lastLanguage);
/* Remember the user's last choice of theme using localStorage */ /* Remember the user's last choice of theme using localStorage */
var themeKey = 'CRYPTPAD_CODE_THEME'; var themeKey = 'CRYPTPAD_CODE_THEME';
var lastTheme = localStorage.getItem(themeKey) || 'default'; var lastTheme = localStorage.getItem(themeKey) || 'default';
/* Let the user select different themes */ /* Let the user select different themes */
var themeDropdown = '<select title="color theme" id="display-theme">\n' + var $themeDropdown = $('<select>', {
Themes.map(function (o) { title: 'color theme',
var selected = o.name === lastTheme? ' selected="selected"': ''; id: 'display-theme',
return '<option value="' + o.name + '"'+selected+'>' + o.name + '</option>'; });
}).join('\n') + Themes.forEach(function (o) {
'</select>'; $themeDropdown.append($('<option>', {
selected: o.name === lastTheme,
}).val(o.name).text(o.name));
});
$rightside.append(syntaxDropdown); $rightside.append(syntaxDropdown);
@ -352,7 +357,7 @@ define([
Cryptpad.setPadAttribute('language', mode); Cryptpad.setPadAttribute('language', mode);
}); });
$rightside.append(themeDropdown); $rightside.append($themeDropdown);
var $theme = $bar.find('select#display-theme'); var $theme = $bar.find('select#display-theme');

Loading…
Cancel
Save