[all] added option to turn on RTL

This commit is contained in:
Maxim Kadushkin 2022-08-19 21:41:24 +03:00
parent a3812a8c3c
commit 684a9668bf
4 changed files with 56 additions and 11 deletions

View file

@ -1,3 +1,17 @@
var checkLocalStorage = (function () {
try {
var storage = window['localStorage'];
return true;
}
catch(e) {
return false;
}
})();
if ( checkLocalStorage && localStorage.getItem("ui-rtl") === '1' ) {
document.body.setAttribute('dir', 'rtl');
document.body.classList.add('rtl');
}
function checkScaling() {
var matches = {
@ -42,16 +56,6 @@ var params = (function() {
return urlParams;
})();
var checkLocalStorage = (function () {
try {
var storage = window['localStorage'];
return true;
}
catch(e) {
return false;
}
})();
if ( window.desktop ) {
var theme = desktop.theme

View file

@ -344,6 +344,9 @@ define([
'<tr>',
'<td colspan="2"><div id="fms-chb-use-alt-key"></div></td>',
'</tr>',
'<tr>',
'<td colspan="2"><div id="fms-chb-rtl-ui"></div></td>',
'</tr>',
'<tr class="themes">',
'<td><label><%= scope.strTheme %></label></td>',
'<td>',
@ -709,6 +712,14 @@ define([
})).on('click', _.bind(me.applySettings, me));
});
this.chRTL = new Common.UI.CheckBox({
el: $markup.findById('#fms-chb-rtl-ui'),
labelText: this.strRTLSupport,
dataHint: '2',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.pnlSettings = $markup.find('.flex-settings').addBack().filter('.flex-settings');
this.pnlApply = $markup.find('.fms-flex-apply').addBack().filter('.fms-flex-apply');
this.pnlTable = this.pnlSettings.find('table');
@ -861,6 +872,7 @@ define([
}
this.chDarkMode.setValue(Common.UI.Themes.isContentThemeDark());
this.chDarkMode.setDisabled(!Common.UI.Themes.isDarkTheme());
this.chRTL.setValue(Common.localStorage.getBool("ui-rtl"));
if (this.mode.canViewReview) {
value = Common.Utils.InternalSettings.get("de-settings-review-hover-mode");
@ -918,6 +930,7 @@ define([
}
Common.localStorage.setItem("de-settings-paste-button", this.chPaste.isChecked() ? 1 : 0);
Common.localStorage.setBool("ui-rtl", this.chRTL.isChecked());
Common.localStorage.save();
@ -988,6 +1001,7 @@ define([
textForceSave: 'Save to Server',
textOldVersions: 'Make the files compatible with older MS Word versions when saved as DOCX',
txtCacheMode: 'Default cache mode',
strRTLSupport: 'RTL interface',
strMacrosSettings: 'Macros Settings',
txtWarnMacros: 'Show Notification',
txtRunMacros: 'Enable All',

View file

@ -269,7 +269,9 @@ define([
'<tr>',
'<td colspan="2"><div id="fms-chb-use-alt-key"></div></td>',
'</tr>',
'<tr>',
'<td colspan="2"><div id="fms-chb-rtl-ui"></div></td>',
'</tr>',
'<tr class="themes">',
'<td><label><%= scope.strTheme %></label></td>',
'<td><span id="fms-cmb-theme"></span></td>',
@ -540,6 +542,14 @@ define([
dataHintOffset: 'big'
});
this.chRTL = new Common.UI.CheckBox({
el: $markup.findById('#fms-chb-rtl-ui'),
labelText: this.strRTLSupport,
dataHint: '2',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
$markup.find('.btn.primary').each(function(index, el){
(new Common.UI.Button({
el: $(el)
@ -670,6 +680,7 @@ define([
this.lblMacrosDesc.text(item ? item.get('descValue') : this.txtWarnMacrosDesc);
this.chPaste.setValue(Common.Utils.InternalSettings.get("pe-settings-paste-button"));
this.chRTL.setValue(Common.localStorage.getBool("ui-rtl"));
var data = [];
for (var t in Common.UI.Themes.map()) {
@ -716,6 +727,7 @@ define([
Common.Utils.InternalSettings.set("pe-macros-mode", this.cmbMacros.getValue());
Common.localStorage.setItem("pe-settings-paste-button", this.chPaste.isChecked() ? 1 : 0);
Common.localStorage.setBool("ui-rtl", this.chRTL.isChecked());
Common.localStorage.save();
@ -768,6 +780,7 @@ define([
textForceSave: 'Save to Server',
txtSpellCheck: 'Spell Checking',
txtCacheMode: 'Default cache mode',
strRTLSupport: 'RTL interface',
strMacrosSettings: 'Macros Settings',
txtWarnMacros: 'Show Notification',
txtRunMacros: 'Enable All',

View file

@ -244,6 +244,9 @@ define([
'<tr>',
'<td colspan="2"><div id="fms-chb-use-alt-key"></div></td>',
'</tr>',
'<tr>',
'<td colspan="2"><div id="fms-chb-rtl-ui"></div></td>',
'</tr>',
'<tr class="themes">',
'<td><label><%= scope.strTheme %></label></td>',
'<td><span id="fms-cmb-theme"></span></td>',
@ -712,6 +715,14 @@ define([
});
this.btnAutoCorrect.on('click', _.bind(this.autoCorrect, this));
this.chRTL = new Common.UI.CheckBox({
el: $markup.findById('#fms-chb-rtl-ui'),
labelText: this.strRTLSupport,
dataHint: '2',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
$markup.find('.btn.primary').each(function(index, el){
(new Common.UI.Button({
el: $(el)
@ -877,6 +888,7 @@ define([
this.cmbMacros.setValue(item ? item.get('value') : 0);
this.chPaste.setValue(Common.Utils.InternalSettings.get("sse-settings-paste-button"));
this.chRTL.setValue(Common.localStorage.getBool("ui-rtl"));
var data = [];
for (var t in Common.UI.Themes.map()) {
@ -977,6 +989,7 @@ define([
Common.Utils.InternalSettings.set("sse-macros-mode", this.cmbMacros.getValue());
Common.localStorage.setItem("sse-settings-paste-button", this.chPaste.isChecked() ? 1 : 0);
Common.localStorage.setBool("ui-rtl", this.chRTL.isChecked());
Common.localStorage.save();
if (this.menu) {
@ -1103,6 +1116,7 @@ define([
strDecimalSeparator: 'Decimal separator',
strThousandsSeparator: 'Thousands separator',
txtCacheMode: 'Default cache mode',
strRTLSupport: 'RTL interface',
strMacrosSettings: 'Macros Settings',
txtWarnMacros: 'Show Notification',
txtRunMacros: 'Enable All',