From 7ecb043d4d8e8b240a966c17cf87bb84aa33e534 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 15 Jan 2021 16:07:10 +0300 Subject: [PATCH 1/2] For Bug 48260 --- apps/common/main/lib/component/ComboBox.js | 5 +++++ .../main/app/view/DropcapSettingsAdvanced.js | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/apps/common/main/lib/component/ComboBox.js b/apps/common/main/lib/component/ComboBox.js index 14a0a185a..edfc2daaa 100644 --- a/apps/common/main/lib/component/ComboBox.js +++ b/apps/common/main/lib/component/ComboBox.js @@ -368,6 +368,11 @@ define([ else this._input.blur(); } + if (!this.isMenuOpen()) { + if ((this.getRawValue() === this.lastValue)) + return true; + this.setRawValue(this._input.val()); + } return false; } else if (e.keyCode == Common.UI.Keys.ESC && this.isMenuOpen()) { diff --git a/apps/documenteditor/main/app/view/DropcapSettingsAdvanced.js b/apps/documenteditor/main/app/view/DropcapSettingsAdvanced.js index b11b9e374..6670875e4 100644 --- a/apps/documenteditor/main/app/view/DropcapSettingsAdvanced.js +++ b/apps/documenteditor/main/app/view/DropcapSettingsAdvanced.js @@ -548,8 +548,12 @@ define([ }) .on('changed:after', _.bind(function(combo, record) { if (me._changedProps) { - me._changedProps.put_XAlign(undefined); - me._changedProps.put_X(Common.Utils.Metric.fnRecalcToMM(Common.Utils.String.parseFloat(record.value))); + if (combo.getSelectedRecord()) { + me._changedProps.put_XAlign(record.value); + } else { + me._changedProps.put_XAlign(undefined); + me._changedProps.put_X(Common.Utils.Metric.fnRecalcToMM(Common.Utils.String.parseFloat(record.value))); + } } }, me)) .on('selected', _.bind(function(combo, record) { @@ -593,8 +597,12 @@ define([ }) .on('changed:after', _.bind(function(combo, record) { if (me._changedProps) { - me._changedProps.put_YAlign(undefined); - me._changedProps.put_Y(Common.Utils.Metric.fnRecalcToMM(Common.Utils.String.parseFloat(record.value))); + if (combo.getSelectedRecord()) { + me._changedProps.put_YAlign(record.value); + } else { + me._changedProps.put_YAlign(undefined); + me._changedProps.put_Y(Common.Utils.Metric.fnRecalcToMM(Common.Utils.String.parseFloat(record.value))); + } } }, me)) .on('selected', _.bind(function(combo, record) { From 43997a0c4e079cf6155bb21b5ffb708d45186030 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Sat, 16 Jan 2021 19:00:17 +0300 Subject: [PATCH 2/2] For Bug 48260 --- apps/common/main/lib/component/ComboBox.js | 9 ++------- apps/common/main/lib/component/ComboBoxFonts.js | 2 ++ .../main/app/view/DropcapSettingsAdvanced.js | 14 ++++++++++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/apps/common/main/lib/component/ComboBox.js b/apps/common/main/lib/component/ComboBox.js index edfc2daaa..d65fbf900 100644 --- a/apps/common/main/lib/component/ComboBox.js +++ b/apps/common/main/lib/component/ComboBox.js @@ -360,20 +360,15 @@ define([ return false; } else if (e.keyCode == Common.UI.Keys.RETURN && (this.editable || this.isMenuOpen())) { + var isopen = this.isMenuOpen(); $(e.target).click(); - var me = this; if (this.rendered) { if (Common.Utils.isIE) this._input.trigger('change', { onkeydown: true }); else this._input.blur(); } - if (!this.isMenuOpen()) { - if ((this.getRawValue() === this.lastValue)) - return true; - this.setRawValue(this._input.val()); - } - return false; + return !isopen; } else if (e.keyCode == Common.UI.Keys.ESC && this.isMenuOpen()) { this._input.val(this.lastValue); diff --git a/apps/common/main/lib/component/ComboBoxFonts.js b/apps/common/main/lib/component/ComboBoxFonts.js index 070536ade..848f33018 100644 --- a/apps/common/main/lib/component/ComboBoxFonts.js +++ b/apps/common/main/lib/component/ComboBoxFonts.js @@ -131,6 +131,8 @@ define([ if ($(e.target).closest('input').length) { // enter in input field if (this.lastValue !== this._input.val()) this._input.trigger('change'); + else + return true; } else { // enter in dropdown list $(e.target).click(); if (this.rendered) { diff --git a/apps/documenteditor/main/app/view/DropcapSettingsAdvanced.js b/apps/documenteditor/main/app/view/DropcapSettingsAdvanced.js index 6670875e4..b5da68de6 100644 --- a/apps/documenteditor/main/app/view/DropcapSettingsAdvanced.js +++ b/apps/documenteditor/main/app/view/DropcapSettingsAdvanced.js @@ -551,8 +551,11 @@ define([ if (combo.getSelectedRecord()) { me._changedProps.put_XAlign(record.value); } else { - me._changedProps.put_XAlign(undefined); - me._changedProps.put_X(Common.Utils.Metric.fnRecalcToMM(Common.Utils.String.parseFloat(record.value))); + var number = Common.Utils.String.parseFloat(record.value); + if (!isNaN(number)) { + me._changedProps.put_XAlign(undefined); + me._changedProps.put_X(Common.Utils.Metric.fnRecalcToMM(number)); + } } } }, me)) @@ -600,8 +603,11 @@ define([ if (combo.getSelectedRecord()) { me._changedProps.put_YAlign(record.value); } else { - me._changedProps.put_YAlign(undefined); - me._changedProps.put_Y(Common.Utils.Metric.fnRecalcToMM(Common.Utils.String.parseFloat(record.value))); + var number = Common.Utils.String.parseFloat(record.value); + if (!isNaN(number)) { + me._changedProps.put_YAlign(undefined); + me._changedProps.put_Y(Common.Utils.Metric.fnRecalcToMM(Common.Utils.String.parseFloat(record.value))); + } } } }, me))