mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-07-26 11:19:45 +08:00
fix: indexes base sources
This commit is contained in:
@ -81,11 +81,12 @@ define([
|
||||
},
|
||||
|
||||
onLaunch: function() {
|
||||
this.statusbar = this.createView('Statusbar').render();
|
||||
this.statusbar = this.createView('Statusbar', { controller: this }).render();
|
||||
this.statusbar.$el.css('z-index', 10);
|
||||
this.statusbar.labelZoom.css('min-width', 80);
|
||||
this.statusbar.labelZoom.text(Common.Utils.String.format(this.zoomText, 100));
|
||||
this.statusbar.zoomMenu.on('item:click', _.bind(this.menuZoomClick, this));
|
||||
// this._lastActiveSheetId = this.api.asc_getActiveWorksheetId();
|
||||
this.$measureSpan = $('<span>').css({
|
||||
position: 'absolute',
|
||||
visibility: 'hidden',
|
||||
@ -203,7 +204,9 @@ define([
|
||||
this.api.asc_registerCallback('asc_generateNewSheetNames', _.bind(function (arrNames, callback) {
|
||||
callback(this.generateSheetNames(false, undefined, arrNames));
|
||||
}, this));
|
||||
|
||||
if (this.api && typeof this.api.asc_getActiveWorksheetId === 'function') {
|
||||
this._lastActiveSheetId = this.api.asc_getActiveWorksheetId();
|
||||
}
|
||||
this.statusbar.setApi(api);
|
||||
},
|
||||
|
||||
@ -963,6 +966,8 @@ define([
|
||||
},
|
||||
|
||||
onApiActiveSheetChanged: function (index) {
|
||||
this._lastActiveSheetId = this.api.asc_getWorksheetId(index)
|
||||
console.log(this._lastActiveSheetId, '- последний активный в onApiActiveSheetChanged', this.api.asc_getWorksheetId(index), 'текущий в onApiActiveSheetChanged')
|
||||
this.statusbar.tabMenu.hide();
|
||||
this.statusbar.sheetListMenu.hide();
|
||||
if (this.statusbar.sheetListMenu.items[index]) {
|
||||
|
||||
@ -444,26 +444,29 @@ define([
|
||||
|
||||
update: function() {
|
||||
var me = this;
|
||||
|
||||
var lastActiveSheetId = this.controller && this.controller._lastActiveSheetId;
|
||||
console.log(lastActiveSheetId, 'в апдейте')
|
||||
this.tabbar.empty(true);
|
||||
this.tabMenu.items[5].menu.removeAll();
|
||||
this.tabMenu.items[5].hide();
|
||||
this.btnAddWorksheet.setDisabled(true);
|
||||
this.sheetListMenu.removeAll();
|
||||
|
||||
if (this.api) {
|
||||
var wc = this.api.asc_getWorksheetsCount(), i = -1;
|
||||
var hidentems = [], items = [], allItems = [], tab, locked, name;
|
||||
var sindex = this.api.asc_getActiveWorksheetIndex();
|
||||
var sid = this.api.asc_getActiveWorksheetId();
|
||||
var wbprotected = this.api.asc_isProtectedWorkbook();
|
||||
|
||||
while (++i < wc) {
|
||||
locked = me.api.asc_isWorksheetLockedOrDeleted(i);
|
||||
name = me.api.asc_getActiveNamedSheetView ? me.api.asc_getActiveNamedSheetView(i) || '' : '';
|
||||
var sheetid = me.api.asc_getWorksheetId(i)
|
||||
tab = {
|
||||
sheetindex : i,
|
||||
sheetid : sheetid,
|
||||
index : items.length,
|
||||
active : sindex == i,
|
||||
active : lastActiveSheetId === sheetid,
|
||||
label : me.api.asc_getWorksheetName(i),
|
||||
// reorderable : !locked,
|
||||
cls : locked ? 'coauth-locked':'',
|
||||
@ -475,7 +478,7 @@ define([
|
||||
this.api.asc_isWorksheetHidden(i)? hidentems.push(tab) : items.push(tab);
|
||||
allItems.push(tab);
|
||||
}
|
||||
|
||||
console.log(allItems)
|
||||
if (hidentems.length) {
|
||||
hidentems.forEach(function(item){
|
||||
me.tabMenu.items[5].menu.addItem(new Common.UI.MenuItem({
|
||||
@ -495,6 +498,7 @@ define([
|
||||
style: 'white-space: pre',
|
||||
caption: Common.Utils.String.htmlEncode(item.label),
|
||||
value: item.sheetindex,
|
||||
sheetid: item.sheetid,
|
||||
checkable: true,
|
||||
checked: item.active,
|
||||
hidden: hidden,
|
||||
|
||||
Reference in New Issue
Block a user