Merge pull request #391 from ONLYOFFICE/feature/pr-fix-bug-45170

[desktop] fix bug 45170
This commit is contained in:
maxkadushkin 2020-04-27 19:58:24 +03:00 committed by GitHub
commit 6c0bd3d8d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -209,32 +209,37 @@ define([
Common.NotificationCenter.trigger('app:config', {canUndock: true}); Common.NotificationCenter.trigger('app:config', {canUndock: true});
} }
var header = webapp.getController('Viewport').getView('Common.Views.Header');
titlebuttons = {}; titlebuttons = {};
if ( !!header.btnSave ) { if ( !mode.isEdit ) {
titlebuttons['save'] = {btn: header.btnSave}; native.execCommand('webapps:features', JSON.stringify(
{version: config.version, eventloading:true, titlebuttons:true, viewmode:true} ));
} else {
var header = webapp.getController('Viewport').getView('Common.Views.Header');
if (!!header.btnSave) {
titlebuttons['save'] = {btn: header.btnSave};
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 ) if (!!header.btnPrint)
titlebuttons['print'] = {btn: header.btnPrint}; titlebuttons['print'] = {btn: header.btnPrint};
if ( !!header.btnUndo ) if (!!header.btnUndo)
titlebuttons['undo'] = {btn: header.btnUndo}; titlebuttons['undo'] = {btn: header.btnUndo};
if ( !!header.btnRedo ) if (!!header.btnRedo)
titlebuttons['redo'] = {btn: header.btnRedo}; titlebuttons['redo'] = {btn: header.btnRedo};
for (var i in titlebuttons) { for (var i in titlebuttons) {
titlebuttons[i].btn.options.signals = ['disabled']; titlebuttons[i].btn.options.signals = ['disabled'];
titlebuttons[i].btn.on('disabled', _onTitleButtonDisabled.bind(this, i)); titlebuttons[i].btn.on('disabled', _onTitleButtonDisabled.bind(this, i));
} }
if (!!titlebuttons.save) { if (!!titlebuttons.save) {
titlebuttons.save.btn.options.signals.push('icon:changed'); titlebuttons.save.btn.options.signals.push('icon:changed');
titlebuttons.save.btn.on('icon:changed', _onSaveIconChanged.bind(this)); titlebuttons.save.btn.on('icon:changed', _onSaveIconChanged.bind(this));
}
} }
if ( !!config.callback_editorconfig ) { if ( !!config.callback_editorconfig ) {