From 308428d83fcee1d39be3cfaee6ab33a3da849e75 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 31 Mar 2020 16:49:33 +0300 Subject: [PATCH] Fix Bug 44916 --- apps/common/main/lib/component/MetricSpinner.js | 12 ++++++------ apps/common/main/lib/util/utils.js | 5 +++++ apps/documenteditor/main/app/controller/Toolbar.js | 4 ++-- .../main/app/view/DropcapSettingsAdvanced.js | 4 ++-- apps/documenteditor/main/app/view/ShapeSettings.js | 2 +- apps/documenteditor/main/app/view/TextArtSettings.js | 2 +- .../main/app/controller/Toolbar.js | 4 ++-- .../main/app/view/ShapeSettings.js | 2 +- .../main/app/view/TextArtSettings.js | 2 +- .../spreadsheeteditor/main/app/controller/Toolbar.js | 4 ++-- .../spreadsheeteditor/main/app/view/ChartSettings.js | 2 +- .../main/app/view/HeaderFooterDialog.js | 4 ++-- .../spreadsheeteditor/main/app/view/ShapeSettings.js | 2 +- .../main/app/view/TextArtSettings.js | 2 +- 14 files changed, 28 insertions(+), 23 deletions(-) diff --git a/apps/common/main/lib/component/MetricSpinner.js b/apps/common/main/lib/component/MetricSpinner.js index 81cf96b1d8..b90673569f 100644 --- a/apps/common/main/lib/component/MetricSpinner.js +++ b/apps/common/main/lib/component/MetricSpinner.js @@ -262,10 +262,10 @@ define([ this.lastValue = this.value; if ( typeof value === 'undefined' || value === ''){ this.value = ''; - } else if (this.options.allowAuto && (Math.abs(parseFloat(value)+1.)<0.0001 || value==this.options.autoText)) { + } else if (this.options.allowAuto && (Math.abs(Common.Utils.String.parseFloat(value)+1.)<0.0001 || value==this.options.autoText)) { this.value = this.options.autoText; } else { - var number = this._add(parseFloat(value), 0, (this.options.allowDecimal) ? 3 : 0); + var number = this._add(Common.Utils.String.parseFloat(value), 0, (this.options.allowDecimal) ? 3 : 0); if ( typeof value === 'undefined' || isNaN(number)) { number = this.oldValue; showError = true; @@ -448,12 +448,12 @@ define([ var val = me.options.step; if (me._fromKeyDown) { val = this.getRawValue(); - val = _.isEmpty(val) ? me.oldValue : parseFloat(val); + val = _.isEmpty(val) ? me.oldValue : Common.Utils.String.parseFloat(val); } else if(me.getValue() !== '') { if (me.options.allowAuto && me.getValue()==me.options.autoText) { val = me.options.minValue-me.options.step; } else - val = parseFloat(me.getValue()); + val = Common.Utils.String.parseFloat(me.getValue()); if (isNaN(val)) val = this.oldValue; } else { @@ -469,12 +469,12 @@ define([ var val = me.options.step; if (me._fromKeyDown) { val = this.getRawValue(); - val = _.isEmpty(val) ? me.oldValue : parseFloat(val); + val = _.isEmpty(val) ? me.oldValue : Common.Utils.String.parseFloat(val); } else if(me.getValue() !== '') { if (me.options.allowAuto && me.getValue()==me.options.autoText) { val = me.options.minValue; } else - val = parseFloat(me.getValue()); + val = Common.Utils.String.parseFloat(me.getValue()); if (isNaN(val)) val = this.oldValue; diff --git a/apps/common/main/lib/util/utils.js b/apps/common/main/lib/util/utils.js index 50e6430b7a..ba490dd3ed 100644 --- a/apps/common/main/lib/util/utils.js +++ b/apps/common/main/lib/util/utils.js @@ -585,6 +585,11 @@ Common.Utils.String = new (function() { } return Common.Utils.String.format(template, string); + }, + + parseFloat: function(string) { + (typeof string === 'string') && (string = string.replace(',', '.')); + return parseFloat(string) } } })(); diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index fb6a6c2e8a..6188040c70 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -1284,7 +1284,7 @@ define([ }); if (!item) { - value = /^\+?(\d*\.?\d+)$|^\+?(\d+\.?\d*)$/.exec(record.value); + value = /^\+?(\d*(\.|,)?\d+)$|^\+?(\d+(\.|,)?\d*)$/.exec(record.value); if (!value) { value = this._getApiTextSize(); @@ -1305,7 +1305,7 @@ define([ } } } else { - value = parseFloat(record.value); + value = Common.Utils.String.parseFloat(record.value); value = value > 100 ? 100 : value < 1 diff --git a/apps/documenteditor/main/app/view/DropcapSettingsAdvanced.js b/apps/documenteditor/main/app/view/DropcapSettingsAdvanced.js index 91a8b39f8c..bce7b1b98a 100644 --- a/apps/documenteditor/main/app/view/DropcapSettingsAdvanced.js +++ b/apps/documenteditor/main/app/view/DropcapSettingsAdvanced.js @@ -572,7 +572,7 @@ define([ .on('changed:after', _.bind(function(combo, record) { if (me._changedProps) { me._changedProps.put_XAlign(undefined); - me._changedProps.put_X(Common.Utils.Metric.fnRecalcToMM(parseFloat(record.value))); + me._changedProps.put_X(Common.Utils.Metric.fnRecalcToMM(Common.Utils.String.parseFloat(record.value))); } }, me)) .on('selected', _.bind(function(combo, record) { @@ -615,7 +615,7 @@ define([ .on('changed:after', _.bind(function(combo, record) { if (me._changedProps) { me._changedProps.put_YAlign(undefined); - me._changedProps.put_Y(Common.Utils.Metric.fnRecalcToMM(parseFloat(record.value))); + me._changedProps.put_Y(Common.Utils.Metric.fnRecalcToMM(Common.Utils.String.parseFloat(record.value))); } }, me)) .on('selected', _.bind(function(combo, record) { diff --git a/apps/documenteditor/main/app/view/ShapeSettings.js b/apps/documenteditor/main/app/view/ShapeSettings.js index d6a64fa255..a376f30f07 100644 --- a/apps/documenteditor/main/app/view/ShapeSettings.js +++ b/apps/documenteditor/main/app/view/ShapeSettings.js @@ -567,7 +567,7 @@ define([ }, applyBorderSize: function(value) { - value = parseFloat(value); + value = Common.Utils.String.parseFloat(value); value = isNaN(value) ? 0 : Math.max(0, Math.min(1584, value)); this.BorderSize = value; diff --git a/apps/documenteditor/main/app/view/TextArtSettings.js b/apps/documenteditor/main/app/view/TextArtSettings.js index 603dfc809a..bcc33070b8 100644 --- a/apps/documenteditor/main/app/view/TextArtSettings.js +++ b/apps/documenteditor/main/app/view/TextArtSettings.js @@ -436,7 +436,7 @@ define([ }, applyBorderSize: function(value) { - value = parseFloat(value); + value = Common.Utils.String.parseFloat(value); value = isNaN(value) ? 0 : Math.max(0, Math.min(1584, value)); this.BorderSize = value; diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 8de8bc8f04..632d452673 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -1206,7 +1206,7 @@ define([ }); if (!item) { - value = /^\+?(\d*\.?\d+)$|^\+?(\d+\.?\d*)$/.exec(record.value); + value = /^\+?(\d*(\.|,).?\d+)$|^\+?(\d+(\.|,)?\d*)$/.exec(record.value); if (!value) { value = this._getApiTextSize(); @@ -1227,7 +1227,7 @@ define([ } } } else { - value = parseFloat(record.value); + value = Common.Utils.String.parseFloat(record.value); value = value > 300 ? 300 : value < 1 ? 1 : Math.floor((value+0.4)*2)/2; diff --git a/apps/presentationeditor/main/app/view/ShapeSettings.js b/apps/presentationeditor/main/app/view/ShapeSettings.js index cda3268774..c6672141e7 100644 --- a/apps/presentationeditor/main/app/view/ShapeSettings.js +++ b/apps/presentationeditor/main/app/view/ShapeSettings.js @@ -547,7 +547,7 @@ define([ }, applyBorderSize: function(value) { - value = parseFloat(value); + value = Common.Utils.String.parseFloat(value); value = isNaN(value) ? 0 : Math.max(0, Math.min(1584, value)); this.BorderSize = value; diff --git a/apps/presentationeditor/main/app/view/TextArtSettings.js b/apps/presentationeditor/main/app/view/TextArtSettings.js index f49ff4febe..7869e39c09 100644 --- a/apps/presentationeditor/main/app/view/TextArtSettings.js +++ b/apps/presentationeditor/main/app/view/TextArtSettings.js @@ -558,7 +558,7 @@ define([ }, applyBorderSize: function(value) { - value = parseFloat(value); + value = Common.Utils.String.parseFloat(value); value = isNaN(value) ? 0 : Math.max(0, Math.min(1584, value)); this.BorderSize = value; diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 9a08232d6c..91241cf986 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -1405,7 +1405,7 @@ define([ }); if (!item) { - value = /^\+?(\d*\.?\d+)$|^\+?(\d+\.?\d*)$/.exec(record.value); + value = /^\+?(\d*(\.|,)?\d+)$|^\+?(\d+(\.|,)?\d*)$/.exec(record.value); if (!value) { value = this._getApiTextSize(); @@ -1426,7 +1426,7 @@ define([ } } } else { - value = parseFloat(record.value); + value = Common.Utils.String.parseFloat(record.value); value = value > 409 ? 409 : value < 1 ? 1 : Math.floor((value+0.4)*2)/2; diff --git a/apps/spreadsheeteditor/main/app/view/ChartSettings.js b/apps/spreadsheeteditor/main/app/view/ChartSettings.js index 18ae392ada..6e96fad091 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ChartSettings.js @@ -1138,7 +1138,7 @@ define([ }, applyBorderSize: function(value) { - value = parseFloat(value); + value = Common.Utils.String.parseFloat(value); value = isNaN(value) ? 1 : Math.max(0.01, Math.min(1584, value)); this.BorderSize = value; diff --git a/apps/spreadsheeteditor/main/app/view/HeaderFooterDialog.js b/apps/spreadsheeteditor/main/app/view/HeaderFooterDialog.js index a9f9890739..08b0d110b8 100644 --- a/apps/spreadsheeteditor/main/app/view/HeaderFooterDialog.js +++ b/apps/spreadsheeteditor/main/app/view/HeaderFooterDialog.js @@ -851,7 +851,7 @@ define([ }); if (!item) { - value = /^\+?(\d*\.?\d+)$|^\+?(\d+\.?\d*)$/.exec(record.value); + value = /^\+?(\d*(\.|,)?\d+)$|^\+?(\d+(\.|,)?\d*)$/.exec(record.value); if (!value) { value = combo.getValue(); @@ -861,7 +861,7 @@ define([ } } } else { - value = parseFloat(record.value); + value = Common.Utils.String.parseFloat(record.value); value = value > 409 ? 409 : value < 1 ? 1 : Math.floor((value+0.4)*2)/2; diff --git a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js index a08c020bb7..10906ffd9a 100644 --- a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js @@ -563,7 +563,7 @@ define([ }, applyBorderSize: function(value) { - value = parseFloat(value); + value = Common.Utils.String.parseFloat(value); value = isNaN(value) ? 0 : Math.max(0, Math.min(1584, value)); this.BorderSize = value; diff --git a/apps/spreadsheeteditor/main/app/view/TextArtSettings.js b/apps/spreadsheeteditor/main/app/view/TextArtSettings.js index 0e420d1cd1..6fde4339a9 100644 --- a/apps/spreadsheeteditor/main/app/view/TextArtSettings.js +++ b/apps/spreadsheeteditor/main/app/view/TextArtSettings.js @@ -559,7 +559,7 @@ define([ }, applyBorderSize: function(value) { - value = parseFloat(value); + value = Common.Utils.String.parseFloat(value); value = isNaN(value) ? 0 : Math.max(0, Math.min(1584, value)); this.BorderSize = value;