From 620f4dc5126f2ffc6ddaa1e66e0821420ba398a7 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 18 May 2017 15:05:37 +0200 Subject: [PATCH] Add translations for the markdown preview button title --- customize.dist/translations/messages.fr.js | 2 ++ customize.dist/translations/messages.js | 2 ++ www/code/main.js | 6 ++++-- www/common/common-codemirror.js | 5 +++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index 24fff7a37..1c204e38c 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -95,6 +95,8 @@ define(function () { out.templateSaved = "Modèle enregistré !"; out.selectTemplate = "Sélectionner un modèle ou appuyer sur Échap"; + out.previewButtonTitle = "Afficher ou cacher la prévisualisation de Markdown"; + out.presentButtonTitle = "Entrer en mode présentation"; out.presentSuccess = 'Appuyer sur Échap pour quitter le mode présentation'; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index c357cb557..4b2c9f78e 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -97,6 +97,8 @@ define(function () { out.templateSaved = "Template saved!"; out.selectTemplate = "Select a template or press escape"; + out.previewButtonTitle = "Display or hide the Markdown preview mode"; + out.presentButtonTitle = "Enter presentation mode"; out.presentSuccess = 'Hit ESC to exit presentation mode'; diff --git a/www/code/main.js b/www/code/main.js index a1261b8ce..6c9fbd0e1 100644 --- a/www/code/main.js +++ b/www/code/main.js @@ -223,7 +223,7 @@ define([ var $previewButton = APP.$previewButton = Cryptpad.createButton(null, true); $previewButton.removeClass('fa-question').addClass('fa-eye'); - $previewButton.attr('title', 'TODO Preview'); //TODO + $previewButton.attr('title', Messages.previewButtonTitle); $previewButton.click(function () { var $codeMirror = $iframe.find('.CodeMirror'); if (CodeMirror.highlightMode !== 'markdown') { @@ -239,7 +239,9 @@ define([ $rightside.append($previewButton); if (!readOnly) { - CodeMirror.configureLanguage(CodeMirror.configureTheme, onModeChanged); + CodeMirror.configureTheme(function () { + CodeMirror.configureLanguage(null, onModeChanged); + }); } else { CodeMirror.configureTheme(); diff --git a/www/common/common-codemirror.js b/www/common/common-codemirror.js index 4bc38cc46..429e9bd9a 100644 --- a/www/common/common-codemirror.js +++ b/www/common/common-codemirror.js @@ -158,10 +158,10 @@ define([ }); if ($rightside) { $rightside.append($block); } - cb(); + if (cb) { cb(); } }; - exp.configureTheme = function () { + exp.configureTheme = function (cb) { /* Remember the user's last choice of theme using localStorage */ var themeKey = 'CRYPTPAD_CODE_THEME'; var lastTheme = localStorage.getItem(themeKey) || 'default'; @@ -195,6 +195,7 @@ define([ }); if ($rightside) { $rightside.append($block); } + if (cb) { cb(); } }; exp.exportText = function () {