[DE] Change styles for Table of contents.
This commit is contained in:
parent
99c5bb7aac
commit
23c0294722
|
@ -216,15 +216,14 @@ define([
|
||||||
menuStyle: 'min-width: 150px;',
|
menuStyle: 'min-width: 150px;',
|
||||||
editable: false,
|
editable: false,
|
||||||
data: [
|
data: [
|
||||||
{ displayValue: this.txtCurrent, value: Asc.c_oAscNumberingFormat.Decimal },
|
{ displayValue: this.txtCurrent, value: Asc.c_oAscTOCStylesType.Current },
|
||||||
{ displayValue: this.txtSimple, value: Asc.c_oAscNumberingFormat.Decimal },
|
{ displayValue: this.txtSimple, value: Asc.c_oAscTOCStylesType.Simple },
|
||||||
{ displayValue: this.txtStandard, value: Asc.c_oAscNumberingFormat.Decimal },
|
{ displayValue: this.txtStandard, value: Asc.c_oAscTOCStylesType.Standard },
|
||||||
{ displayValue: this.txtModern, value: Asc.c_oAscNumberingFormat.Decimal },
|
{ displayValue: this.txtModern, value: Asc.c_oAscTOCStylesType.Modern },
|
||||||
{ displayValue: this.txtClassic, value: Asc.c_oAscNumberingFormat.Decimal }
|
{ displayValue: this.txtClassic, value: Asc.c_oAscTOCStylesType.Classic }
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
// this.cmbStyles.setValue();
|
this.cmbStyles.setValue(Asc.c_oAscTOCStylesType.Current);
|
||||||
// this.cmbStyles.on('selected', _.bind(this.onStylesSelect, this));
|
|
||||||
|
|
||||||
this.spnLevels = new Common.UI.CustomSpinner({
|
this.spnLevels = new Common.UI.CustomSpinner({
|
||||||
el: $('#tableofcontents-spin-levels'),
|
el: $('#tableofcontents-spin-levels'),
|
||||||
|
@ -281,21 +280,27 @@ define([
|
||||||
|
|
||||||
_setDefaults: function (props) {
|
_setDefaults: function (props) {
|
||||||
var me = this,
|
var me = this,
|
||||||
|
docStyles = this.api.asc_GetStylesArray(),
|
||||||
styles = [];
|
styles = [];
|
||||||
_.each(window.styles.get_MergedStyles(), function (style) {
|
_.each(docStyles, function (style) {
|
||||||
var level = me.api.asc_GetHeadingLevel(style.get_Name());
|
var name = style.get_Name(),
|
||||||
|
level = me.api.asc_GetHeadingLevel(name);
|
||||||
|
if (style.get_QFormat() || level>=0) {
|
||||||
styles.push({
|
styles.push({
|
||||||
name: style.get_Name(),
|
name: name,
|
||||||
allowSelected: false,
|
allowSelected: false,
|
||||||
checked: false,
|
checked: false,
|
||||||
value: '',
|
value: '',
|
||||||
headerLevel: (level>0) ? level+1 : -1 // -1 if is not header
|
headerLevel: (level>=0) ? level+1 : -1 // -1 if is not header
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (props) {
|
if (props) {
|
||||||
var value = props.get_Hyperlink();
|
var value = props.get_Hyperlink();
|
||||||
this.chLinks.setValue((value !== null && value !== undefined) ? value : 'indeterminate', true);
|
this.chLinks.setValue((value !== null && value !== undefined) ? value : 'indeterminate', true);
|
||||||
|
value = props.get_StylesType();
|
||||||
|
this.cmbStyles.setValue((value!==null) ? value : Asc.c_oAscTOCStylesType.Current);
|
||||||
|
|
||||||
var start = props.get_OutlineStart(),
|
var start = props.get_OutlineStart(),
|
||||||
end = props.get_OutlineEnd(),
|
end = props.get_OutlineEnd(),
|
||||||
|
@ -447,6 +452,7 @@ define([
|
||||||
if (this.chPages.getValue() == 'checked')
|
if (this.chPages.getValue() == 'checked')
|
||||||
props.put_RightAlignTab(this.chAlign.getValue() == 'checked');
|
props.put_RightAlignTab(this.chAlign.getValue() == 'checked');
|
||||||
props.put_TabLeader(this.cmbLeader.getValue());
|
props.put_TabLeader(this.cmbLeader.getValue());
|
||||||
|
props.put_StylesType(this.cmbStyles.getValue());
|
||||||
|
|
||||||
props.clear_Styles();
|
props.clear_Styles();
|
||||||
if (this._needUpdateOutlineLevels) {
|
if (this._needUpdateOutlineLevels) {
|
||||||
|
@ -477,11 +483,11 @@ define([
|
||||||
});
|
});
|
||||||
input.on('input', function(e) {
|
input.on('input', function(e) {
|
||||||
// console.log(input.val());
|
// console.log(input.val());
|
||||||
var newval = !_.isEmpty(input.val());
|
var isEmpty = _.isEmpty(input.val());
|
||||||
if (record.get('checked') !== newval) {
|
if (record.get('checked') !== !isEmpty) {
|
||||||
record.set('checked', !_.isEmpty(input.val()));
|
record.set('checked', !isEmpty);
|
||||||
}
|
}
|
||||||
record.set('value', input.val());
|
record.set('value', (isEmpty) ? '' : parseInt(input.val()));
|
||||||
me._needUpdateOutlineLevels = true;
|
me._needUpdateOutlineLevels = true;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue