[DE] Fast updating name of the headers in the table of contents.
This commit is contained in:
parent
ac78e89a58
commit
1a3b022467
|
@ -83,6 +83,9 @@ define([
|
|||
this.api = api;
|
||||
this.api.asc_registerCallback('asc_onDocumentOutlineUpdate', _.bind(this.updateNavigation, this));
|
||||
this.api.asc_registerCallback('asc_onDocumentOutlineCurrentPosition', _.bind(this.onChangeOutlinePosition, this));
|
||||
this.api.asc_registerCallback('asc_onDocumentOutlineUpdateAdd', _.bind(this.updateNavigation, this));
|
||||
this.api.asc_registerCallback('asc_onDocumentOutlineUpdateChange', _.bind(this.updateChangeNavigation, this));
|
||||
this.api.asc_registerCallback('asc_onDocumentOutlineUpdateRemove', _.bind(this.updateNavigation, this));
|
||||
return this;
|
||||
},
|
||||
|
||||
|
@ -123,6 +126,19 @@ define([
|
|||
this.getApplication().getCollection('Navigation').reset(arr);
|
||||
},
|
||||
|
||||
updateChangeNavigation: function(index) {
|
||||
if (!this._navigationObject) return;
|
||||
|
||||
var item = this.getApplication().getCollection('Navigation').at(index);
|
||||
if (item.get('level') !== this._navigationObject.get_Level(index) ||
|
||||
index==0 && item.get('isNotHeader') !== this._navigationObject.isFirstItemNotHeader()) {
|
||||
this.updateNavigation();
|
||||
} else {
|
||||
item.set('name', this._navigationObject.get_Text(index));
|
||||
item.set('isEmptyItem', this._navigationObject.isEmptyItem(index));
|
||||
}
|
||||
},
|
||||
|
||||
onChangeOutlinePosition: function(index) {
|
||||
this.panelNavigation.viewNavigationList.selectByIndex(index);
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue