From dc06aab506ed7ca30bb70c34e1fb67bc1d1e54d6 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Wed, 5 Oct 2022 20:24:35 +0300 Subject: [PATCH] [rtl] Make dropdown menu (margins, size, custom zoom) --- apps/common/main/resources/less/toolbar.less | 4 ++ apps/documenteditor/main/app/view/Toolbar.js | 19 +++++-- .../main/app/view/Toolbar.js | 51 ++++++++++++------- .../main/resources/less/toolbar.less | 41 +++++++++++++++ 4 files changed, 92 insertions(+), 23 deletions(-) diff --git a/apps/common/main/resources/less/toolbar.less b/apps/common/main/resources/less/toolbar.less index d29a43791..ccad589b0 100644 --- a/apps/common/main/resources/less/toolbar.less +++ b/apps/common/main/resources/less/toolbar.less @@ -752,6 +752,10 @@ &.colors { display: inline-block; margin-right: 15px; + .rtl & { + margin-right: 0; + margin-left: 15px; + } } &.color { diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 5e047099c..91b3943a7 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -1032,13 +1032,21 @@ define([ this.toolbarControls.push(this.btnPageOrient); - var pageMarginsTemplate = _.template('
<%= caption %>
' + + var pageMarginsTemplate = !Common.UI.isRTL() ? _.template('
<%= caption %>
' + '<% if (options.value !== null) { %>
' + '' + '
' + '
' + '' + '
' + + '<% } %>
') : + _.template('
<%= caption %>
' + + '<% if (options.value !== null) { %>
' + + '' + + '
' + + '
' + + '' + + '
' + '<% } %>
'); this.btnPageMargins = new Common.UI.Button({ @@ -1101,9 +1109,12 @@ define([ }); this.toolbarControls.push(this.btnPageMargins); - var pageSizeTemplate = _.template('
<%= caption %>
' + - '
<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[0]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %> x ' + - '<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[1]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %>
'); + var pageSizeTemplate = !Common.UI.isRTL() ? _.template('
<%= caption %>
' + + '
<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[0]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %> x ' + + '<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[1]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %>
') : + _.template('
<%= caption %>
' + + '
<%= Common.Utils.Metric.getCurrentMetricName() %> <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[1]).toFixed(2)) %> x ' + + '<%= Common.Utils.Metric.getCurrentMetricName() %> <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[0]).toFixed(2)) %>
'); this.btnPageSize = new Common.UI.Button({ id: 'tlbtn-pagesize', diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 429ef8dea..df3add848 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -1674,12 +1674,21 @@ define([ dataHintOffset: 'small' }); - var pageMarginsTemplate = _.template('
<%= caption %>
' + - '<% if (options.value !== null) { %>
' + - '' + - '
' + - '' + - '
' + + var pageMarginsTemplate = !Common.UI.isRTL() ? _.template('
<%= caption %>
' + + '<% if (options.value !== null) { %>
' + + '' + + '
' + + '
' + + '' + + '
' + + '<% } %>
') : + _.template('
<%= caption %>
' + + '<% if (options.value !== null) { %>
' + + '' + + '
' + + '
' + + '' + + '
' + '<% } %>
'); me.btnPageMargins = new Common.UI.Button({ @@ -1689,6 +1698,7 @@ define([ caption: me.capBtnMargins, lock : [_set.docPropsLock, _set.lostConnect, _set.coAuth, _set.editCell, _set.selRangeEdit], menu: new Common.UI.Menu({ + cls: 'menu-margins', items: [ { caption: me.textMarginsLast, @@ -1726,9 +1736,12 @@ define([ dataHintOffset: 'small' }); - var pageSizeTemplate = _.template('
<%= caption %>
' + - '
<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[0]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %> x ' + - '<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[1]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %>
'); + var pageSizeTemplate = !Common.UI.isRTL() ? _.template('
<%= caption %>
' + + '
<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[0]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %> x ' + + '<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[1]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %>
') : + _.template('
<%= caption %>
' + + '
<%= Common.Utils.Metric.getCurrentMetricName() %> <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[1]).toFixed(2)) %> x ' + + '<%= Common.Utils.Metric.getCurrentMetricName() %> <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[0]).toFixed(2)) %>
'); me.btnPageSize = new Common.UI.Button({ id: 'tlbtn-pagesize', @@ -1884,16 +1897,16 @@ define([ me.mnuCustomScale = new Common.UI.MenuItem({ template: _.template([ - '
', - 'data-stopPropagation="true"', - '<% } %>', '>', - '', - '', - '', - '', - '
' - ].join('')), + '
', + 'data-stopPropagation="true"', + '<% } %>', '>', + '', + '', + '', + '', + '
' + ].join('')), stopPropagation: true, value: 4 }); diff --git a/apps/spreadsheeteditor/main/resources/less/toolbar.less b/apps/spreadsheeteditor/main/resources/less/toolbar.less index 6c84ecc9e..3fe74ecd0 100644 --- a/apps/spreadsheeteditor/main/resources/less/toolbar.less +++ b/apps/spreadsheeteditor/main/resources/less/toolbar.less @@ -146,3 +146,44 @@ margin-right: 2px; } } + +.custom-scale { + padding: 5px 5px 5px 20px; + font-weight: normal; + line-height: 1.42857143; + font-size: 11px; + height: 32px; + .rtl & { + padding: 5px 20px 5px 5px; + } + .title { + padding-top: 3px; + padding-right: 5px; + .rtl & { + padding-right: 0; + padding-left: 5px; + float: right; + } + } + #custom-scale-up { + float:right; + .rtl & { + float: left; + } + } + #value-custom-scale { + float:right; + padding: 3px 3px; + min-width: 40px; + text-align: center; + .rtl & { + float: left; + } + } + #custom-scale-down { + float:right; + .rtl & { + float: left; + } + } +}