add _really_ basic multilanguage support. I'll come back for css later

pull/1/head
ansuz 9 years ago
parent 31aa09d6f6
commit a89511985f

@ -9,10 +9,11 @@ define([
'json.sortify',
'/bower_components/chainpad-json-validator/json-ot.js',
'/common/cryptpad-common.js',
'/code/modes.js',
'/bower_components/file-saver/FileSaver.min.js',
'/bower_components/jquery/dist/jquery.min.js',
'/customize/pad.js'
], function (Config, /*RTCode,*/ Messages, Crypto, Realtime, TextPatcher, Toolbar, JSONSortify, JsonOT, Cryptpad) {
], function (Config, /*RTCode,*/ Messages, Crypto, Realtime, TextPatcher, Toolbar, JSONSortify, JsonOT, Cryptpad, Modes) {
var $ = window.jQuery;
var saveAs = window.saveAs;
var module = window.APP = {};
@ -160,6 +161,20 @@ define([
config.onLocal();
}));
var dropdown = '<select id="language-mode">\n' +
Modes.map(function (o) {
return '<option value="' + o.mode + '">' + o.language + '</option>';
}).join('\n') +
'</select>';
$bar.find('.rtwysiwyg-toolbar-rightside').append(dropdown);
$bar.find('#language-mode').on('change', function () {
console.log($(this).val());
setMode($(this).val());
});
window.location.hash = info.channel + secret.key;
Cryptpad.rememberPad();
};

@ -0,0 +1,13 @@
define(function () {
return [
"Javascript javascript",
"Python python",
"Mixed_HTML htmlmixed",
].map(function (line) {
var kv = line.split(/\s/);
return {
language: kv[0].replace(/_/g, ' '),
mode: kv[1]
};
});
});
Loading…
Cancel
Save