[SSE] Add handler for print button in print preview menu
This commit is contained in:
parent
e232acc272
commit
8e9d5dcea0
|
@ -78,7 +78,9 @@ define([
|
||||||
|
|
||||||
onAfterRender: function(view) {
|
onAfterRender: function(view) {
|
||||||
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));
|
this.printSettings.btnSave.on('click', _.bind(this.querySavePrintSettings, this, false));
|
||||||
|
this.printSettings.btnPrint.on('click', _.bind(this.querySavePrintSettings, this, true));
|
||||||
|
|
||||||
this.fillComponents(this.printSettings);
|
this.fillComponents(this.printSettings);
|
||||||
this.registerControlEvents(this.printSettings);
|
this.registerControlEvents(this.printSettings);
|
||||||
},
|
},
|
||||||
|
@ -335,10 +337,23 @@ define([
|
||||||
this.printSettingsDlg = null;
|
this.printSettingsDlg = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
querySavePrintSettings: function() {
|
querySavePrintSettings: function(print) {
|
||||||
if ( this.checkMargins(this.printSettings) ) {
|
if ( this.checkMargins(this.printSettings) ) {
|
||||||
this.savePageOptions(this.printSettings);
|
this.savePageOptions(this.printSettings);
|
||||||
this.printSettings.applySettings();
|
this.printSettings.applySettings();
|
||||||
|
|
||||||
|
if (print) {
|
||||||
|
var printType = this.printSettings.getRange();
|
||||||
|
this.adjPrintParams.asc_setPrintType(printType);
|
||||||
|
this.adjPrintParams.asc_setPageOptionsMap(this._changedProps);
|
||||||
|
this.adjPrintParams.asc_setIgnorePrintArea(this.printSettings.getIgnorePrintArea());
|
||||||
|
Common.localStorage.setItem("sse-print-settings-range", printType);
|
||||||
|
|
||||||
|
var opts = new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera || Common.Utils.isGecko && Common.Utils.firefoxVersion>86);
|
||||||
|
opts.asc_setAdvancedOptions(this.adjPrintParams);
|
||||||
|
this.api.asc_Print(opts);
|
||||||
|
Common.NotificationCenter.trigger('edit:complete', view);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -2745,8 +2745,8 @@ define([
|
||||||
'<tr><td class="padding-large"><button type="button" class="btn btn-text-default" id="print-apply-all" style="width: 118px;" data-hint="2" data-hint-direction="bottom" data-hint-offset="medium"><%= scope.txtApplyToAllSheets %></button></td></tr>',
|
'<tr><td class="padding-large"><button type="button" class="btn btn-text-default" id="print-apply-all" style="width: 118px;" data-hint="2" data-hint-direction="bottom" data-hint-offset="medium"><%= scope.txtApplyToAllSheets %></button></td></tr>',
|
||||||
'<tr class="fms-btn-apply"><td>',
|
'<tr class="fms-btn-apply"><td>',
|
||||||
'<div class="footer justify">',
|
'<div class="footer justify">',
|
||||||
'<button class="btn normal dlg-btn primary" result="print" style="width: 96px;"><%= scope.txtPrint %></button>',
|
'<button id="print-btn-print" class="btn normal dlg-btn primary" result="print" style="width: 96px;"><%= scope.txtPrint %></button>',
|
||||||
'<button id="print-button-save" class="btn normal dlg-btn" result="save" style="width: 96px;"><%= scope.txtSave %></button>',
|
'<button id="print-btn-save" class="btn normal dlg-btn" result="save" style="width: 96px;"><%= scope.txtSave %></button>',
|
||||||
'</div>',
|
'</div>',
|
||||||
'</td></tr>',
|
'</td></tr>',
|
||||||
'</tbody>',
|
'</tbody>',
|
||||||
|
@ -2754,8 +2754,8 @@ define([
|
||||||
'</div>',
|
'</div>',
|
||||||
'<div class="fms-flex-apply hidden">',
|
'<div class="fms-flex-apply hidden">',
|
||||||
'<div class="footer justify">',
|
'<div class="footer justify">',
|
||||||
'<button class="btn normal dlg-btn primary" result="print" style="width: 96px;"><%= scope.txtPrint %></button>',
|
'<button id="print-btn-print" class="btn normal dlg-btn primary" result="print" style="width: 96px;"><%= scope.txtPrint %></button>',
|
||||||
'<button id="print-button-save" class="btn normal dlg-btn" result="save" style="width: 96px;"><%= scope.txtSave %></button>',
|
'<button id="print-btn-save" class="btn normal dlg-btn" result="save" style="width: 96px;"><%= scope.txtSave %></button>',
|
||||||
'</div>',
|
'</div>',
|
||||||
'</div>',
|
'</div>',
|
||||||
'</div>',
|
'</div>',
|
||||||
|
@ -2868,7 +2868,7 @@ define([
|
||||||
itemsTemplate: itemsTemplate
|
itemsTemplate: itemsTemplate
|
||||||
});
|
});
|
||||||
|
|
||||||
this.txtRangeTop = new Common.UI.InputFieldBtn({
|
this.txtRangeTop = new Common.UI.InputField({
|
||||||
el: $markup.findById('#print-txt-top'),
|
el: $markup.findById('#print-txt-top'),
|
||||||
allowBlank: true,
|
allowBlank: true,
|
||||||
validateOnChange: true
|
validateOnChange: true
|
||||||
|
@ -2882,7 +2882,7 @@ define([
|
||||||
menu: true
|
menu: true
|
||||||
});
|
});
|
||||||
|
|
||||||
this.txtRangeLeft = new Common.UI.InputFieldBtn({
|
this.txtRangeLeft = new Common.UI.InputField({
|
||||||
el: $markup.findById('#print-txt-left'),
|
el: $markup.findById('#print-txt-left'),
|
||||||
allowBlank: true,
|
allowBlank: true,
|
||||||
validateOnChange: true
|
validateOnChange: true
|
||||||
|
@ -2960,7 +2960,11 @@ define([
|
||||||
this.trApply = $markup.find('.fms-btn-apply');
|
this.trApply = $markup.find('.fms-btn-apply');
|
||||||
|
|
||||||
this.btnSave = new Common.UI.Button({
|
this.btnSave = new Common.UI.Button({
|
||||||
el: $markup.findById('#print-button-save')
|
el: $markup.findById('#print-btn-save')
|
||||||
|
});
|
||||||
|
|
||||||
|
this.btnPrint = new Common.UI.Button({
|
||||||
|
el: $markup.findById('#print-btn-print')
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$el = $(node).html($markup);
|
this.$el = $(node).html($markup);
|
||||||
|
|
Loading…
Reference in a new issue