[SSE] Add init and close print preview methods

This commit is contained in:
JuliaSvinareva 2021-10-26 20:21:24 +03:00
parent 2f5805d3ac
commit 7cc2f854e8

View file

@ -77,6 +77,7 @@ define([
}, },
onAfterRender: function(view) { onAfterRender: function(view) {
this.printSettings.menu.on('menu:hide', _.bind(this.onHidePrintMenu, this));
this.printSettings.cmbSheet.on('selected', _.bind(this.comboSheetsChange, this, this.printSettings)); this.printSettings.cmbSheet.on('selected', _.bind(this.comboSheetsChange, this, this.printSettings));
this.printSettings.btnSave.on('click', _.bind(this.querySavePrintSettings, this, false)); this.printSettings.btnSave.on('click', _.bind(this.querySavePrintSettings, this, false));
this.printSettings.btnPrint.on('click', _.bind(this.querySavePrintSettings, this, true)); this.printSettings.btnPrint.on('click', _.bind(this.querySavePrintSettings, this, true));
@ -276,6 +277,8 @@ define([
} }
this.fillPrintOptions(this.adjPrintParams, false); this.fillPrintOptions(this.adjPrintParams, false);
this._pagePreviewCount = this.api.asc_initPrintPreview('print-preview');
}, },
openPrintSettings: function(type, cmp, format, asUrl) { openPrintSettings: function(type, cmp, format, asUrl) {
@ -340,6 +343,7 @@ define([
querySavePrintSettings: function(print) { querySavePrintSettings: function(print) {
if ( this.checkMargins(this.printSettings) ) { if ( this.checkMargins(this.printSettings) ) {
this.savePageOptions(this.printSettings); this.savePageOptions(this.printSettings);
this._isPrint = print;
this.printSettings.applySettings(); this.printSettings.applySettings();
if (print) { if (print) {
@ -353,6 +357,8 @@ define([
opts.asc_setAdvancedOptions(this.adjPrintParams); opts.asc_setAdvancedOptions(this.adjPrintParams);
this.api.asc_Print(opts); this.api.asc_Print(opts);
Common.NotificationCenter.trigger('edit:complete', view); Common.NotificationCenter.trigger('edit:complete', view);
this._isPrint = false;
} }
} }
}, },
@ -573,6 +579,10 @@ define([
} }
}, },
onHidePrintMenu: function () {
this.api.asc_closePrintPreview(this._isPrint);
},
warnCheckMargings: 'Margins are incorrect', warnCheckMargings: 'Margins are incorrect',
strAllSheets: 'All Sheets', strAllSheets: 'All Sheets',
textWarning: 'Warning', textWarning: 'Warning',