Update Desktop.js (#349)

This commit is contained in:
maxkadushkin 2020-02-25 18:23:38 +03:00 committed by GitHub
parent 257b3509d8
commit ca46cf41b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -193,23 +193,30 @@ define([
} }
var header = webapp.getController('Viewport').getView('Common.Views.Header'); var header = webapp.getController('Viewport').getView('Common.Views.Header');
titlebuttons = { titlebuttons = {};
'save': {btn: header.btnSave, disabled:false}, if ( !!header.btnSave ) {
'print': {btn: header.btnPrint, disabled:false}, titlebuttons['save'] = {btn: header.btnSave, disabled:false};
'undo': {btn: header.btnUndo, disabled:false},
'redo': {btn: header.btnRedo, disabled:false}
};
for (var i in titlebuttons) {
titlebuttons[i].btn.options.signals = ['disabled'];
titlebuttons[i].btn.on('disabled', _onTitleButtonDisabled.bind(this, i));
}
header.btnSave.options.signals.push('icon:changed'); header.btnSave.options.signals.push('icon:changed');
header.btnSave.on('icon:changed', _onSaveIconChanged.bind(this)); header.btnSave.on('icon:changed', _onSaveIconChanged.bind(this));
var iconname = /\s?([^\s]+)$/.exec(titlebuttons.save.btn.$icon.attr('class')); var iconname = /\s?([^\s]+)$/.exec(titlebuttons.save.btn.$icon.attr('class'));
!!iconname && iconname.length && (titlebuttons.save.icon = btnsave_icons[iconname]); !!iconname && iconname.length && (titlebuttons.save.icon = btnsave_icons[iconname]);
}
if ( !!header.btnPrint )
titlebuttons['print'] = {btn: header.btnPrint, disabled:false};
if ( !!header.btnUndo )
titlebuttons['undo'] = {btn: header.btnUndo, disabled:false};
if ( !!header.btnRedo )
titlebuttons['redo'] = {btn: header.btnRedo, disabled:false};
for (var i in titlebuttons) {
titlebuttons[i].btn.options.signals = ['disabled'];
titlebuttons[i].btn.on('disabled', _onTitleButtonDisabled.bind(this, i));
}
if ( !!config.callback_editorconfig ) { if ( !!config.callback_editorconfig ) {
config.callback_editorconfig(); config.callback_editorconfig();