[DE] Fix Bug 48154

This commit is contained in:
Julia Radzhabova 2021-09-02 23:26:46 +03:00
parent 89e99a323f
commit c5326a95a7

View file

@ -319,8 +319,8 @@ define([
if (newValue) { if (newValue) {
this.levelsContainer.toggleClass('hidden', !newValue); this.levelsContainer.toggleClass('hidden', !newValue);
this.stylesContainer.toggleClass('hidden', newValue); this.stylesContainer.toggleClass('hidden', newValue);
if (this._needUpdateOutlineLevels) if (this._needUpdateOutlineLevels || this._forceUpdateOutlineLevels)
this.synchronizeLevelsFromStyles(); this.synchronizeLevelsFromStyles(true);
} }
}, this)); }, this));
@ -354,19 +354,7 @@ define([
allowDecimal: false, allowDecimal: false,
maskExp: /[1-9]/ maskExp: /[1-9]/
}); });
this.spnLevels.on('change', _.bind(function(field, newValue, oldValue, eOpts){ this.spnLevels.on('change', _.bind(this.onLevelsChange, this));
this._needUpdateStyles = true;
this.startLevel = 1;
this.endLevel = field.getNumberValue();
if (this.api && !this._noApply) {
var properties = (this._originalProps) ? this._originalProps : new Asc.CTableOfContentsPr();
properties.clear_Styles();
properties.put_OutlineRange(this.startLevel, this.endLevel);
this.api.SetDrawImagePlaceContents('tableofcontents-img', properties);
this.scrollerY.update();
}
}, this));
this.stylesLevels = new Common.UI.DataViewStore(); this.stylesLevels = new Common.UI.DataViewStore();
@ -629,6 +617,7 @@ define([
}); });
this.stylesLevels.reset(styles); this.stylesLevels.reset(styles);
if (checkStyles) { if (checkStyles) {
this._forceUpdateOutlineLevels = true;
this.radioStyles.setValue(true); this.radioStyles.setValue(true);
this.stylesList.scroller.update({alwaysVisibleY: true}); this.stylesList.scroller.update({alwaysVisibleY: true});
var rec = this.stylesLevels.findWhere({checked: true}); var rec = this.stylesLevels.findWhere({checked: true});
@ -715,7 +704,7 @@ define([
this._needUpdateStyles = false; this._needUpdateStyles = false;
}, },
synchronizeLevelsFromStyles: function() { synchronizeLevelsFromStyles: function(reset) {
var new_start = -1, new_end = -1, empty_index = -1, var new_start = -1, new_end = -1, empty_index = -1,
disable_outlines = false; disable_outlines = false;
@ -756,8 +745,10 @@ define([
this.startLevel = new_start; this.startLevel = new_start;
this.endLevel = new_end; this.endLevel = new_end;
this.spnLevels.setValue(new_end>0 ? new_end : '', true); this.spnLevels.setValue(new_end>0 ? new_end : (reset ? 9 : ''), true);
reset && (new_end<=0) && this.onLevelsChange(this.spnLevels);
this._needUpdateOutlineLevels = false; this._needUpdateOutlineLevels = false;
this._forceUpdateOutlineLevels = false;
}, },
getSettings: function () { getSettings: function () {
@ -862,6 +853,20 @@ define([
} }
}, },
onLevelsChange: function(field, newValue, oldValue, eOpts){
this._needUpdateStyles = true;
this.startLevel = 1;
this.endLevel = field.getNumberValue();
if (this.api && !this._noApply) {
var properties = (this._originalProps) ? this._originalProps : new Asc.CTableOfContentsPr();
properties.clear_Styles();
properties.put_OutlineRange(this.startLevel, this.endLevel);
this.api.SetDrawImagePlaceContents('tableofcontents-img', properties);
this.scrollerY.update();
}
},
disableButtons: function() { disableButtons: function() {
this.type && this.btnOk.setDisabled(this.radioCaption.getValue() && this.cmbCaptions.getValue()===null || this.radioStyle.getValue() && this.cmbTOFStyles.length<1); this.type && this.btnOk.setDisabled(this.radioCaption.getValue() && this.cmbCaptions.getValue()===null || this.radioStyle.getValue() && this.cmbTOFStyles.length<1);
}, },