[desktop] event on show 'quick print' button

This commit is contained in:
Maxim Kadushkin 2022-11-22 00:28:55 +03:00
parent 4fa78dad3a
commit 8e25f9c027

View file

@ -45,7 +45,8 @@ define([
version: '{{PRODUCT_VERSION}}',
eventloading: true,
titlebuttons: true,
uithemes: true
uithemes: true,
quickprint: true,
};
var native = window.desktop || window.AscDesktopEditor;
@ -166,7 +167,8 @@ define([
action: action,
icon: config.icon || undefined,
hint: config.btn.options.hint,
disabled: config.btn.isDisabled()
disabled: config.btn.isDisabled(),
visible: config.visible,
};
};
@ -217,6 +219,19 @@ define([
}
}
const _onApplySettings = function (menu) {
if ( !!titlebuttons.printquick ) {
if ( titlebuttons.printquick.visible != titlebuttons.printquick.btn.isVisible() ) {
const obj = {
visible: {
quickprint: titlebuttons.printquick.btn.isVisible(),
}
};
native.execCommand('title:button', JSON.stringify(obj));
}
}
}
return {
init: function (opts) {
_.extend(config, opts);
@ -283,8 +298,12 @@ define([
if (!!header.btnPrint)
titlebuttons['print'] = {btn: header.btnPrint};
if (!!header.btnPrintQuick)
titlebuttons['printquick'] = {btn: header.btnPrintQuick};
if (!!header.btnPrintQuick) {
titlebuttons['printquick'] = {
btn: header.btnPrintQuick,
visible: header.btnPrintQuick.isVisible(),
};
}
if (!!header.btnUndo)
titlebuttons['undo'] = {btn: header.btnUndo};
@ -340,6 +359,7 @@ define([
menu.hide();
}
},
'settings:apply': _onApplySettings.bind(this),
},
}, {id: 'desktop'});