diff --git a/doc/api/embed_parameters.md b/doc/api/embed_parameters.md index 3100fff9d..dcbe3e5b3 100644 --- a/doc/api/embed_parameters.md +++ b/doc/api/embed_parameters.md @@ -60,3 +60,9 @@ Default: en Example: `lang=ar` (translates the interface into Arabic) +## rtl + * Boolean + +Default: true +Displays pad text from right to left. + diff --git a/src/locales/en.json b/src/locales/en.json index bef6dfd05..920a2b003 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -29,6 +29,7 @@ "pad.settings.stickychat": "Chat always on screen", "pad.settings.colorcheck": "Authorship colors", "pad.settings.linenocheck": "Line numbers", + "pad.settings.rtlcheck": "Read content from right to left?", "pad.settings.fontType": "Font type:", "pad.settings.fontType.normal": "Normal", "pad.settings.fontType.monospaced": "Monospace", diff --git a/src/static/js/pad.js b/src/static/js/pad.js index 6e8b2ae01..4b0526208 100644 --- a/src/static/js/pad.js +++ b/src/static/js/pad.js @@ -313,7 +313,7 @@ function handshake() if (settings.rtlIsTrue == true) { - pad.changeViewOption('rtl', true); + pad.changeViewOption('rtlIsTrue', true); } // If the Monospacefont value is set to true then change it to monospace. diff --git a/src/static/js/pad_editor.js b/src/static/js/pad_editor.js index dd0cbbbb7..b73409ff3 100644 --- a/src/static/js/pad_editor.js +++ b/src/static/js/pad_editor.js @@ -62,20 +62,36 @@ var padeditor = (function() }, initViewOptions: function() { + // Line numbers padutils.bindCheckboxChange($("#options-linenoscheck"), function() { pad.changeViewOption('showLineNumbers', padutils.getCheckbox($("#options-linenoscheck"))); }); + + // Author colors padutils.bindCheckboxChange($("#options-colorscheck"), function() { padcookie.setPref('showAuthorshipColors', padutils.getCheckbox("#options-colorscheck")); pad.changeViewOption('showAuthorColors', padutils.getCheckbox("#options-colorscheck")); }); + + // Right to left + padutils.bindCheckboxChange($("#options-rtlcheck"), function() + { + pad.changeViewOption('rtlIsTrue', padutils.getCheckbox($("#options-rtlcheck"))) + }); + html10n.bind('localized', function() { + pad.changeViewOption('rtlIsTrue', ('rtl' == html10n.getDirection())); + padutils.setCheckbox($("#options-rtlcheck"), ('rtl' == html10n.getDirection())); + }) + + // font face $("#viewfontmenu").change(function() { pad.changeViewOption('useMonospaceFont', $("#viewfontmenu").val() == 'monospace'); }); + // Language html10n.bind('localized', function() { $("#languagemenu").val(html10n.getLanguage()); // translate the value of 'unnamed' and 'Enter your name' textboxes in the userlist @@ -104,12 +120,14 @@ var padeditor = (function() if (value == "false") return false; return defaultValue; } - self.ace.setProperty("rtlIsTrue", settings.rtlIsTrue); var v; - v = getOption('rtlIsTrue', false); + v = getOption('rtlIsTrue', ('rtl' == html10n.getDirection())); + // Override from parameters if true + if(settings.rtlIsTrue === true) v = true; self.ace.setProperty("rtlIsTrue", v); + padutils.setCheckbox($("#options-rtlcheck"), v); v = getOption('showLineNumbers', true); self.ace.setProperty("showslinenumbers", v); diff --git a/src/templates/pad.html b/src/templates/pad.html index 76df5133c..1d8c069a5 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -217,6 +217,10 @@

+

+ + +

<% e.end_block(); %> <% e.begin_block("mySettings.dropdowns"); %>