Merge pull request #1706 from ONLYOFFICE/fix/bug_56693_new

Fix/bug 56693 new
This commit is contained in:
Julia Radzhabova 2022-04-19 13:11:38 +03:00 committed by GitHub
commit a2b2c63bd1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -124,6 +124,7 @@ define([
this.api.asc_registerCallback('asc_onSheetsChanged', _.bind(this.updateSheetsInfo, this));
this.api.asc_registerCallback('asc_onPrintPreviewSheetChanged', _.bind(this.onApiChangePreviewSheet, this));
this.api.asc_registerCallback('asc_onPrintPreviewPageChanged', _.bind(this.onApiChangePreviewPage, this));
this.api.asc_registerCallback('asc_onPrintPreviewSheetDataChanged', _.bind(this.onApiPreviewSheetDataChanged, this));
},
updateSheetsInfo: function() {
@ -152,6 +153,7 @@ define([
panel.cmbSheet.store.findWhere({value: this.api.asc_getActiveWorksheetIndex()});
if (item) {
panel.cmbSheet.setValue(item.get('value'));
panel.updateActiveSheet && panel.updateActiveSheet(item.get('displayValue'));
}
},
@ -711,6 +713,8 @@ define([
updatePreview: function (needUpdate) {
if (this._isPreviewVisible) {
this.printSettings.$previewBox.removeClass('hidden');
var adjPrintParams = new Asc.asc_CAdjustPrint(),
printType = this.printSettings.getRange();
adjPrintParams.asc_setPrintType(printType);
@ -721,13 +725,15 @@ define([
opts.asc_setAdvancedOptions(adjPrintParams);
var pageCount = this.api.asc_updatePrintPreview(opts);
this.printSettings.$previewBox.toggleClass('hidden', !pageCount);
this.printSettings.$previewEmpty.toggleClass('hidden', !!pageCount);
var newPage;
if (this._currentPrintType !== printType) {
newPage = 0;
this._currentPrintType = printType;
} else if (this._navigationPreview.currentPage > pageCount - 1) {
newPage = pageCount - 1;
newPage = Math.max(0, pageCount - 1);
} else {
newPage = this._navigationPreview.currentPage;
}
@ -740,16 +746,14 @@ define([
},
onApiChangePreviewSheet: function (index) {
var item = this.printSettings.cmbSheet.store.findWhere({value: index});
this.printSettings.updateActiveSheet(item.get('displayValue'));
if (this.notUpdateSheetSettings) {
this.notUpdateSheetSettings = false;
return
}
var item = this.printSettings.cmbSheet.store.findWhere({value: index});
if (item) {
} else if (item) {
this.printSettings.cmbSheet.setValue(item.get('value'));
this.comboSheetsChange(this.printSettings, this.printSettings.cmbSheet, item.toJSON());
var sheetName = this.api.asc_getWorksheetName(index);
this.printSettings.updateActiveSheet(sheetName);
}
},
@ -786,6 +790,16 @@ define([
}
},
onApiPreviewSheetDataChanged: function (needUpdate) {
if (needUpdate) {
this.updatePreview();
} else {
this.notUpdateSheetSettings = true;
this.api.asc_drawPrintPreview(this._navigationPreview.currentPage);
this.updateNavigationButtons(this._navigationPreview.currentPage, this._navigationPreview.pageCount);
}
},
warnCheckMargings: 'Margins are incorrect',
strAllSheets: 'All Sheets',
textWarning: 'Warning',