diff --git a/apps/spreadsheeteditor/main/app/controller/Print.js b/apps/spreadsheeteditor/main/app/controller/Print.js index 9e71204ef..c21b0e894 100644 --- a/apps/spreadsheeteditor/main/app/controller/Print.js +++ b/apps/spreadsheeteditor/main/app/controller/Print.js @@ -77,6 +77,7 @@ define([ }, 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.btnSave.on('click', _.bind(this.querySavePrintSettings, this, false)); this.printSettings.btnPrint.on('click', _.bind(this.querySavePrintSettings, this, true)); @@ -276,6 +277,8 @@ define([ } this.fillPrintOptions(this.adjPrintParams, false); + + this._pagePreviewCount = this.api.asc_initPrintPreview('print-preview'); }, openPrintSettings: function(type, cmp, format, asUrl) { @@ -340,6 +343,7 @@ define([ querySavePrintSettings: function(print) { if ( this.checkMargins(this.printSettings) ) { this.savePageOptions(this.printSettings); + this._isPrint = print; this.printSettings.applySettings(); if (print) { @@ -353,6 +357,8 @@ define([ opts.asc_setAdvancedOptions(this.adjPrintParams); this.api.asc_Print(opts); 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', strAllSheets: 'All Sheets', textWarning: 'Warning',