From 5c8231afd9971799fecf02c8180c9c499d7babd9 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 30 Oct 2020 21:55:58 +0300 Subject: [PATCH] [DE] Form settings: use auto size of cell width --- apps/common/main/lib/component/MetricSpinner.js | 6 +++++- apps/documenteditor/main/app/view/FormSettings.js | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/common/main/lib/component/MetricSpinner.js b/apps/common/main/lib/component/MetricSpinner.js index 6f69c9217..777f74416 100644 --- a/apps/common/main/lib/component/MetricSpinner.js +++ b/apps/common/main/lib/component/MetricSpinner.js @@ -448,7 +448,7 @@ define([ val = _.isEmpty(val) ? me.oldValue : Common.Utils.String.parseFloat(val); } else if(me.getValue() !== '') { if (me.checkAutoText(me.getValue())) { - val = me.options.minValue-me.options.step; + val = me.options.defaultValue-me.options.step; } else val = Common.Utils.String.parseFloat(me.getValue()); if (isNaN(val)) @@ -536,6 +536,10 @@ define([ return v_out; }, + setDefaultValue: function(value) { + this.options.defaultValue = value; + }, + checkAutoText: function(value) { if (this.options.allowAuto && typeof value == 'string') { var val = value.toLowerCase(); diff --git a/apps/documenteditor/main/app/view/FormSettings.js b/apps/documenteditor/main/app/view/FormSettings.js index 61e290de4..96484361b 100644 --- a/apps/documenteditor/main/app/view/FormSettings.js +++ b/apps/documenteditor/main/app/view/FormSettings.js @@ -653,6 +653,12 @@ define([ this._state.Width=val; } + val = this.api.asc_GetTextFormAutoWidth(); + if ( (this._state.WidthPlaceholder!==val) || Math.abs(this._state.WidthPlaceholder-val)>0.01) { + this.spnWidth.setDefaultValue(val!==undefined && val!==null ? Common.Utils.Metric.fnRecalcFromMM(val) : this.spnWidth.options.minValue); + this._state.WidthPlaceholder=val; + } + val = formTextPr.get_MaxCharacters(); this.chMaxChars.setValue(val && val>=0); this.spnMaxChars.setDisabled(!val || val<0);