QuickPrint for compactHeader

This commit is contained in:
OVSharova 2022-11-24 08:21:13 +03:00
parent 7e7f519caf
commit fc8e344dd9
2 changed files with 54 additions and 3 deletions

View file

@ -372,6 +372,7 @@ define([
Common.Gateway.on('setmailmergerecipients', _.bind(this.setMailMergeRecipients, this));
$('#id-toolbar-menu-new-control-color').on('click', _.bind(this.onNewControlsColor, this));
toolbar.listStylesAdditionalMenuItem.on('click', this.onMenuSaveStyle.bind(this));
toolbar.btnPrint.menu && toolbar.btnPrint.menu.on('item:click', _.bind(this.onPrintMenu, this));
this.onSetupCopyStyleButton();
this.onBtnChangeState('undo:disabled', toolbar.btnUndo, toolbar.btnUndo.isDisabled());
@ -1061,11 +1062,35 @@ define([
},
onPrint: function(e) {
if (this.toolbar.btnPrint.options.printType == 'print') {
Common.NotificationCenter.trigger('file:print', this.toolbar);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
} else {
var _main = this.getApplication().getController('Main');
_main.onPrintQuick();
}
Common.component.Analytics.trackEvent('Print');
Common.component.Analytics.trackEvent('ToolBar', 'Print');
},
onPrintMenu: function (btn, e){
var oldType = this.toolbar.btnPrint.options.printType;
var newType = e.value;
//this.toolbar.btnPrint.toggle(true);
if(newType != oldType) {
this.toolbar.btnPrint.changeIcon({
next: e.options.iconClsForMainBtn,
curr: this.toolbar.btnPrint.menu.items.filter(function(item){return item.value == oldType;})[0].options.iconClsForMainBtn
});
this.toolbar.btnPrint.updateHint([e.caption, this.views.Toolbar.prototype.tipInsertText]);
this.toolbar.btnPrint.options.printType = newType;
}
this.onPrint(e);
},
onSave: function(e) {

View file

@ -192,8 +192,11 @@ define([
lock: [_set.cantPrint, _set.disableOnStart],
signals: ['disabled'],
dataHint: '1',
split: config.canQuickPrint && Common.localStorage.getBool("de-settings-quick-print-button",false),
menu: config.canQuickPrint && Common.localStorage.getBool("de-settings-quick-print-button",false),
dataHintDirection: 'top',
dataHintTitle: 'P'
dataHintTitle: 'P',
printType: 'print'
});
this.toolbarControls.push(this.btnPrint);
@ -1744,6 +1747,28 @@ define([
})).then(function () {
if ( !config.isEdit ) return;
if(me.btnPrint && config.canQuickPrint && Common.localStorage.getBool("de-settings-quick-print-button",false)){
me.btnPrint.setMenu(
new Common.UI.Menu({
items:[
{
caption: 'Print',
iconCls: 'menu__icon btn-print',
toggleGroup: 'viewPrint',
value: 'print',
iconClsForMainBtn: 'btn-print'
},
{
caption: 'QuickPrint',
iconCls: 'menu__icon btn-quick-print',
toggleGroup: 'viewPrint',
value: 'print-quick',
iconClsForMainBtn: 'btn-quick-print'
}
]
}));
}
me.btnsPageBreak.forEach( function(btn) {
btn.updateHint( [me.textInsPageBreak, me.tipPageBreak] );
@ -2030,6 +2055,7 @@ define([
ids.push('id-toolbar-menu-markers-level-' + i);
items.push({template: levelTemplate, previewId: ids[i], level: i, checkable: true });
}
this.btnMarkers.setMenu(
new Common.UI.Menu({
cls: 'shifted-left',