|
|
@ -48,15 +48,11 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var setMode = exp.setMode = function (mode, cb) {
|
|
|
|
var setMode = exp.setMode = function (mode, cb) {
|
|
|
|
exp.highlightMode = mode;
|
|
|
|
exp.highlightMode = mode;
|
|
|
|
if (mode === 'text') {
|
|
|
|
if (mode !== "text") { CMeditor.autoLoadMode(editor, mode); }
|
|
|
|
editor.setOption('mode', 'text');
|
|
|
|
|
|
|
|
if (cb) { cb('text'); }
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
CMeditor.autoLoadMode(editor, mode);
|
|
|
|
|
|
|
|
editor.setOption('mode', mode);
|
|
|
|
editor.setOption('mode', mode);
|
|
|
|
if (exp.$language) {
|
|
|
|
if (exp.$language) {
|
|
|
|
var name = exp.$language.find('a[data-value="' + mode + '"]').text() || 'Mode';
|
|
|
|
var name = exp.$language.find('a[data-value="' + mode + '"]').text() || undefined;
|
|
|
|
|
|
|
|
name = name ? Messages.languageButton + ' ('+name+')' : Messages.languageButton;
|
|
|
|
exp.$language.setValue(name);
|
|
|
|
exp.$language.setValue(name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(cb) { cb(mode); }
|
|
|
|
if(cb) { cb(mode); }
|
|
|
@ -88,7 +84,9 @@ define([
|
|
|
|
editor.setOption('theme', theme);
|
|
|
|
editor.setOption('theme', theme);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($select) {
|
|
|
|
if ($select) {
|
|
|
|
$select.setValue(theme || 'Theme');
|
|
|
|
var name = theme || undefined;
|
|
|
|
|
|
|
|
name = name ? Messages.themeButton + ' ('+theme+')' : Messages.themeButton;
|
|
|
|
|
|
|
|
$select.setValue(name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}());
|
|
|
|
}());
|
|
|
@ -152,6 +150,7 @@ define([
|
|
|
|
isSelect: true,
|
|
|
|
isSelect: true,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var $block = exp.$language = Cryptpad.createDropdown(dropdownConfig);
|
|
|
|
var $block = exp.$language = Cryptpad.createDropdown(dropdownConfig);
|
|
|
|
|
|
|
|
$block.find('button').attr('title', Messages.languageButtonTitle);
|
|
|
|
$block.find('a').click(function () {
|
|
|
|
$block.find('a').click(function () {
|
|
|
|
setMode($(this).attr('data-value'), onModeChanged);
|
|
|
|
setMode($(this).attr('data-value'), onModeChanged);
|
|
|
|
onLocal();
|
|
|
|
onLocal();
|
|
|
@ -185,6 +184,7 @@ define([
|
|
|
|
initialValue: lastTheme
|
|
|
|
initialValue: lastTheme
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var $block = exp.$theme = Cryptpad.createDropdown(dropdownConfig);
|
|
|
|
var $block = exp.$theme = Cryptpad.createDropdown(dropdownConfig);
|
|
|
|
|
|
|
|
$block.find('button').attr('title', Messages.themeButtonTitle);
|
|
|
|
|
|
|
|
|
|
|
|
setTheme(lastTheme, $block);
|
|
|
|
setTheme(lastTheme, $block);
|
|
|
|
|
|
|
|
|
|
|
|