From ae7135459eac7d3f6b88d0b8c05abd1d843c2fce Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 22 Jan 2021 15:59:23 +0300 Subject: [PATCH] [DE] Fix Bug 48354 --- .../main/app/view/FormSettings.js | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/apps/documenteditor/main/app/view/FormSettings.js b/apps/documenteditor/main/app/view/FormSettings.js index f579d2789a..e898f73459 100644 --- a/apps/documenteditor/main/app/view/FormSettings.js +++ b/apps/documenteditor/main/app/view/FormSettings.js @@ -79,6 +79,7 @@ define([ this._originalTextFormProps = null; this._originalFormProps = null; this._originalProps = null; + this.forceUpdate = false; this.render(); }, @@ -332,6 +333,7 @@ define([ onKeyChanged: function(combo, record) { if (this.api && !this._noApply) { + this.forceUpdate = true; var props = this._originalProps || new AscCommon.CContentControlPr(); var formPr = this._originalFormProps || new AscCommon.CSdtFormPr(); formPr.put_Key(record.value); @@ -343,6 +345,7 @@ define([ onPlaceholderChanged: function(input, newValue, oldValue, e) { if (this.api && !this._noApply && (newValue!==oldValue)) { + this.forceUpdate = true; var props = this._originalProps || new AscCommon.CContentControlPr(); props.put_PlaceholderText(newValue || ' '); this.api.asc_SetContentControlProperties(props, this.internalId); @@ -353,6 +356,7 @@ define([ onHelpChanged: function(input, newValue, oldValue, e) { if (this.api && !this._noApply && (newValue!==oldValue)) { + this.forceUpdate = true; var props = this._originalProps || new AscCommon.CContentControlPr(); var formPr = this._originalFormProps || new AscCommon.CSdtFormPr(); formPr.put_HelpText(newValue); @@ -383,6 +387,7 @@ define([ onMaxCharsChange: function(field, newValue, oldValue, eOpts){ if (this.api && !this._noApply) { + this.forceUpdate = true; var props = this._originalProps || new AscCommon.CContentControlPr(); var formTextPr = this._originalTextFormProps || new AscCommon.CSdtTextFormPr(); var checked = (this.chMaxChars.getValue()=='checked' || this.chComb.getValue()=='checked'); @@ -420,6 +425,7 @@ define([ onWidthChange: function(field, newValue, oldValue, eOpts){ if (this.api && !this._noApply) { + this.forceUpdate = true; var props = this._originalProps || new AscCommon.CContentControlPr(); var formTextPr = this._originalTextFormProps || new AscCommon.CSdtTextFormPr(); if (this.spnWidth.getValue()) { @@ -436,6 +442,7 @@ define([ onGroupKeyChanged: function(combo, record) { if (this.api && !this._noApply) { + this.forceUpdate = true; var props = this._originalProps || new AscCommon.CContentControlPr(); var specProps = this._originalCheckProps || new AscCommon.CSdtCheckBoxPr(); specProps.put_GroupKey(record.value); @@ -587,9 +594,10 @@ define([ this._noApply = true; this.internalId = props.get_InternalId(); + this.forceUpdate = this.forceUpdate && (this.internalId !== this._state.internalId); var val = props.get_PlaceholderText(); - if (this._state.placeholder !== val) { + if (this._state.placeholder !== val || this.forceUpdate) { this.txtPlaceholder.setValue(val ? val : ''); this._state.placeholder = val; } @@ -654,7 +662,7 @@ define([ this.labelFormName.text(this.textImage); } else data = this.api.asc_GetTextFormKeys(); - if (!this._state.arrKey || _.difference(this._state.arrKey, data).length>0) { + if (!this._state.arrKey || _.difference(this._state.arrKey, data).length>0 || this.forceUpdate) { var arr = []; data.forEach(function(item) { arr.push({ displayValue: item, value: item }); @@ -664,7 +672,7 @@ define([ } val = formPr.get_Key(); - if (this._state.Key!==val) { + if (this._state.Key!==val || this.forceUpdate) { this.cmbKey.setValue(val ? val : ''); this._state.Key=val; } @@ -676,7 +684,7 @@ define([ connected && this.labelConnectedFields.text(this.textConnected + ': ' + val); val = formPr.get_HelpText(); - if (this._state.help!==val) { + if (this._state.help!==val || this.forceUpdate) { this.textareaHelp.setValue(val ? val : ''); this._state.help=val; } @@ -686,7 +694,7 @@ define([ var ischeckbox = (typeof val !== 'string'); if (!ischeckbox) { data = this.api.asc_GetRadioButtonGroupKeys(); - if (!this._state.arrGroupKey || _.difference(this._state.arrGroupKey, data).length>0) { + if (!this._state.arrGroupKey || _.difference(this._state.arrGroupKey, data).length>0 || this.forceUpdate) { var arr = []; data.forEach(function(item) { arr.push({ displayValue: item, value: item }); @@ -695,7 +703,7 @@ define([ this._state.arrGroupKey=data; } - if (this._state.groupKey!==val) { + if (this._state.groupKey!==val || this.forceUpdate) { this.cmbGroupKey.setValue(val ? val : ''); this._state.groupKey=val; } @@ -720,7 +728,7 @@ define([ this.spnWidth.setDisabled(!val); val = formTextPr.get_Width(); - if ( (val===undefined || this._state.Width===undefined)&&(this._state.Width!==val) || Math.abs(this._state.Width-val)>0.1) { + if ( (val===undefined || this._state.Width===undefined)&&(this._state.Width!==val) || Math.abs(this._state.Width-val)>0.1 || this.forceUpdate) { this.spnWidth.setValue(val!==0 && val!==undefined ? Common.Utils.Metric.fnRecalcFromMM(val * 25.4 / 20 / 72.0) : -1, true); this._state.Width=val; } @@ -734,7 +742,7 @@ define([ val = formTextPr.get_MaxCharacters(); this.chMaxChars.setValue(val && val>=0); this.spnMaxChars.setDisabled(!val || val<0); - if ( (val===undefined || this._state.MaxChars===undefined)&&(this._state.MaxChars!==val) || Math.abs(this._state.MaxChars-val)>0.1) { + if ( (val===undefined || this._state.MaxChars===undefined)&&(this._state.MaxChars!==val) || Math.abs(this._state.MaxChars-val)>0.1 || this.forceUpdate) { this.spnMaxChars.setValue(val && val>=0 ? val : 10, true); this._state.MaxChars=val; } @@ -776,6 +784,7 @@ define([ this.type = type; this._state.internalId = this.internalId; + this.forceUpdate = false; } },