Merge pull request #1706 from ONLYOFFICE/fix/bug_56693_new
Fix/bug 56693 new
This commit is contained in:
commit
a2b2c63bd1
|
@ -124,6 +124,7 @@ define([
|
||||||
this.api.asc_registerCallback('asc_onSheetsChanged', _.bind(this.updateSheetsInfo, this));
|
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_onPrintPreviewSheetChanged', _.bind(this.onApiChangePreviewSheet, this));
|
||||||
this.api.asc_registerCallback('asc_onPrintPreviewPageChanged', _.bind(this.onApiChangePreviewPage, this));
|
this.api.asc_registerCallback('asc_onPrintPreviewPageChanged', _.bind(this.onApiChangePreviewPage, this));
|
||||||
|
this.api.asc_registerCallback('asc_onPrintPreviewSheetDataChanged', _.bind(this.onApiPreviewSheetDataChanged, this));
|
||||||
},
|
},
|
||||||
|
|
||||||
updateSheetsInfo: function() {
|
updateSheetsInfo: function() {
|
||||||
|
@ -152,6 +153,7 @@ define([
|
||||||
panel.cmbSheet.store.findWhere({value: this.api.asc_getActiveWorksheetIndex()});
|
panel.cmbSheet.store.findWhere({value: this.api.asc_getActiveWorksheetIndex()});
|
||||||
if (item) {
|
if (item) {
|
||||||
panel.cmbSheet.setValue(item.get('value'));
|
panel.cmbSheet.setValue(item.get('value'));
|
||||||
|
panel.updateActiveSheet && panel.updateActiveSheet(item.get('displayValue'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -711,6 +713,8 @@ define([
|
||||||
|
|
||||||
updatePreview: function (needUpdate) {
|
updatePreview: function (needUpdate) {
|
||||||
if (this._isPreviewVisible) {
|
if (this._isPreviewVisible) {
|
||||||
|
this.printSettings.$previewBox.removeClass('hidden');
|
||||||
|
|
||||||
var adjPrintParams = new Asc.asc_CAdjustPrint(),
|
var adjPrintParams = new Asc.asc_CAdjustPrint(),
|
||||||
printType = this.printSettings.getRange();
|
printType = this.printSettings.getRange();
|
||||||
adjPrintParams.asc_setPrintType(printType);
|
adjPrintParams.asc_setPrintType(printType);
|
||||||
|
@ -721,13 +725,15 @@ define([
|
||||||
opts.asc_setAdvancedOptions(adjPrintParams);
|
opts.asc_setAdvancedOptions(adjPrintParams);
|
||||||
|
|
||||||
var pageCount = this.api.asc_updatePrintPreview(opts);
|
var pageCount = this.api.asc_updatePrintPreview(opts);
|
||||||
|
this.printSettings.$previewBox.toggleClass('hidden', !pageCount);
|
||||||
|
this.printSettings.$previewEmpty.toggleClass('hidden', !!pageCount);
|
||||||
|
|
||||||
var newPage;
|
var newPage;
|
||||||
if (this._currentPrintType !== printType) {
|
if (this._currentPrintType !== printType) {
|
||||||
newPage = 0;
|
newPage = 0;
|
||||||
this._currentPrintType = printType;
|
this._currentPrintType = printType;
|
||||||
} else if (this._navigationPreview.currentPage > pageCount - 1) {
|
} else if (this._navigationPreview.currentPage > pageCount - 1) {
|
||||||
newPage = pageCount - 1;
|
newPage = Math.max(0, pageCount - 1);
|
||||||
} else {
|
} else {
|
||||||
newPage = this._navigationPreview.currentPage;
|
newPage = this._navigationPreview.currentPage;
|
||||||
}
|
}
|
||||||
|
@ -740,16 +746,14 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onApiChangePreviewSheet: function (index) {
|
onApiChangePreviewSheet: function (index) {
|
||||||
|
var item = this.printSettings.cmbSheet.store.findWhere({value: index});
|
||||||
|
this.printSettings.updateActiveSheet(item.get('displayValue'));
|
||||||
|
|
||||||
if (this.notUpdateSheetSettings) {
|
if (this.notUpdateSheetSettings) {
|
||||||
this.notUpdateSheetSettings = false;
|
this.notUpdateSheetSettings = false;
|
||||||
return
|
} else if (item) {
|
||||||
}
|
|
||||||
var item = this.printSettings.cmbSheet.store.findWhere({value: index});
|
|
||||||
if (item) {
|
|
||||||
this.printSettings.cmbSheet.setValue(item.get('value'));
|
this.printSettings.cmbSheet.setValue(item.get('value'));
|
||||||
this.comboSheetsChange(this.printSettings, this.printSettings.cmbSheet, item.toJSON());
|
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',
|
warnCheckMargings: 'Margins are incorrect',
|
||||||
strAllSheets: 'All Sheets',
|
strAllSheets: 'All Sheets',
|
||||||
textWarning: 'Warning',
|
textWarning: 'Warning',
|
||||||
|
|
Loading…
Reference in a new issue