diff --git a/apps/common/main/lib/component/MetricSpinner.js b/apps/common/main/lib/component/MetricSpinner.js index 81cf96b1d..b90673569 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 50e6430b7..ba490dd3e 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 fb6a6c2e8..6188040c7 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 91a8b39f8..bce7b1b98 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 d6a64fa25..a376f30f0 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 603dfc809..bcc33070b 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 8de8bc8f0..632d45267 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 cda326877..c6672141e 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 f49ff4feb..7869e39c0 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 9a08232d6..91241cf98 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 18ae392ad..6e96fad09 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 a9f989073..08b0d110b 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 a08c020bb..10906ffd9 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 0e420d1cd..6fde4339a 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;