Skip to content

Commit

Permalink
Merge pull request 'Fix Bug 71888' (#166) from fix/bug-71888 into rel…
Browse files Browse the repository at this point in the history
…ease/v8.3.0
  • Loading branch information
Julia Radzhabova committed Dec 6, 2024
2 parents d8242fd + 3df19a6 commit a6c8c83
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 59 deletions.
7 changes: 6 additions & 1 deletion apps/common/main/lib/view/ReviewChanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,12 @@ define([
if ((!me.btnMailRecepients || !Common.UI.LayoutManager.isElementVisible('toolbar-collaboration-mailmerge')) && separator_last)
me.$el.find(separator_last).hide();

Common.NotificationCenter.trigger('tab:visible', 'review', (config.isEdit || config.canViewReview || me.canComments) && Common.UI.LayoutManager.isElementVisible('toolbar-collaboration'));
var visible = (config.isEdit || config.canViewReview || me.canComments) && Common.UI.LayoutManager.isElementVisible('toolbar-collaboration');
Common.NotificationCenter.trigger('tab:visible', 'review', visible);
if (Common.Utils.InternalSettings.get('toolbar-active-tab') && visible) { // collaboration tab has hign priority in view mode
Common.Utils.InternalSettings.set('toolbar-active-tab', null);
Common.NotificationCenter.trigger('tab:set-active', 'review');
}
setEvents.call(me);
});
},
Expand Down
30 changes: 19 additions & 11 deletions apps/documenteditor/main/app/controller/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ define([
Common.NotificationCenter.on('toolbar:collapse', _.bind(function () {
this.toolbar.collapse();
}, this));
Common.NotificationCenter.on('tab:set-active', _.bind(function(action){
this.toolbar.setTab(action);
this.onChangeCompactView(null, false, true);
}, this));
},

onLaunch: function() {
Expand Down Expand Up @@ -507,12 +511,14 @@ define([
Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this));
},

onChangeCompactView: function(view, compact) {
onChangeCompactView: function(view, compact, suppressSave) {
this.toolbar.setFolded(compact);
this.toolbar.fireEvent('view:compact', [this, compact]);
compact && this.onTabCollapse();

Common.localStorage.setBool('de-compact-toolbar', compact);
var editmode = this.mode.isEdit || this.mode.isRestrictedEdit && this.mode.canFillForms && this.mode.isFormCreator;
!suppressSave && Common.localStorage.setBool(editmode ? "de-compact-toolbar" : "de-view-compact-toolbar", compact);

Common.NotificationCenter.trigger('layout:changed', 'toolbar');
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
Expand Down Expand Up @@ -3547,16 +3553,16 @@ define([
var me = this,
application = this.getApplication();

var compactview = !(config.isEdit || config.isRestrictedEdit && config.canFillForms && config.isFormCreator);
if ( config.isEdit || config.isRestrictedEdit && config.canFillForms && config.isFormCreator) {
if ( Common.localStorage.itemExists("de-compact-toolbar") ) {
compactview = Common.localStorage.getBool("de-compact-toolbar");
} else
if ( config.customization && config.customization.compactToolbar )
compactview = true;
var editmode = config.isEdit || config.isRestrictedEdit && config.canFillForms && config.isFormCreator,
compactview = !editmode;
if ( Common.localStorage.itemExists(editmode ? "de-compact-toolbar" : "de-view-compact-toolbar") ) {
compactview = Common.localStorage.getBool(editmode ? "de-compact-toolbar" : "de-view-compact-toolbar");
} else if (config.customization) {
compactview = editmode ? !!config.customization.compactToolbar : config.customization.compactToolbar!==false;
}
Common.Utils.InternalSettings.set('toolbar-active-tab', !editmode && !compactview);

me.toolbar.render(_.extend({isCompactView: compactview}, config));
me.toolbar.render(_.extend({isCompactView: editmode ? compactview : true}, config));

var tab = {action: 'review', caption: me.toolbar.textTabCollaboration, dataHintTitle: 'U', layoutname: 'toolbar-collaboration'};
var $panel = me.application.getController('Common.Controllers.ReviewChanges').createToolbarPanel();
Expand Down Expand Up @@ -3665,8 +3671,10 @@ define([
viewtab.setApi(me.api).setConfig({toolbar: me, mode: config});
$panel = viewtab.createToolbarPanel();
if ($panel) {
var visible = Common.UI.LayoutManager.isElementVisible('toolbar-view');
me.toolbar.addTab(tab, $panel, 8);
me.toolbar.setVisible('view', Common.UI.LayoutManager.isElementVisible('toolbar-view'));
me.toolbar.setVisible('view', visible);
!editmode && !compactview && visible && Common.Utils.InternalSettings.set('toolbar-active-tab', 'view'); // need to activate later
}
config.isEdit && Array.prototype.push.apply(me.toolbar.lockControls, viewtab.getView('ViewTab').getButtons());
},
Expand Down
3 changes: 3 additions & 0 deletions apps/documenteditor/main/app/controller/ViewTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ define([
}, 0);
}
}

if (Common.Utils.InternalSettings.get('toolbar-active-tab')==='view')
Common.NotificationCenter.trigger('tab:set-active', 'view');
});
}
},
Expand Down
30 changes: 19 additions & 11 deletions apps/pdfeditor/main/app/controller/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ define([
this.toolbar.collapse();
}, this));
Common.NotificationCenter.on('comments:tryshowcomments', _.bind(this.turnOnShowComments, this));
Common.NotificationCenter.on('tab:set-active', _.bind(function(action){
this.toolbar.setTab(action);
this.onChangeCompactView(null, false, true);
}, this));
},

onLaunch: function() {
Expand Down Expand Up @@ -427,13 +431,15 @@ define([
this.attachRestrictedEditApiEvents();
},

onChangeCompactView: function(view, compact) {
onChangeCompactView: function(view, compact, suppressSave) {
this.toolbar.setFolded(compact);
this.toolbar.fireEvent('view:compact', [this, compact]);

compact && this.onTabCollapse();

Common.localStorage.setBool('pdfe-compact-toolbar', compact);
var editmode = this.mode.isEdit || this.mode.isRestrictedEdit;
!suppressSave && Common.localStorage.setBool(editmode ? "pdfe-compact-toolbar" : "pdfe-view-compact-toolbar", compact);

Common.NotificationCenter.trigger('layout:changed', 'toolbar');
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
Expand Down Expand Up @@ -1253,16 +1259,16 @@ define([
onAppShowed: function (config) {
var me = this;

var compactview = !(config.isEdit || config.isRestrictedEdit);
if ( config.isEdit || config.isRestrictedEdit) {
if ( Common.localStorage.itemExists("pdfe-compact-toolbar") ) {
compactview = Common.localStorage.getBool("pdfe-compact-toolbar");
} else
if ( config.customization && config.customization.compactToolbar )
compactview = true;
var editmode = config.isEdit || config.isRestrictedEdit,
compactview = !editmode;
if ( Common.localStorage.itemExists(editmode ? "pdfe-compact-toolbar" : "pdfe-view-compact-toolbar") ) {
compactview = Common.localStorage.getBool(editmode ? "pdfe-compact-toolbar" : "pdfe-view-compact-toolbar");
} else if (config.customization) {
compactview = editmode ? !!config.customization.compactToolbar : config.customization.compactToolbar!==false;
}
Common.Utils.InternalSettings.set('toolbar-active-tab', !editmode && !compactview);

me.toolbar.render(_.extend({isCompactView: compactview}, config));
me.toolbar.render(_.extend({isCompactView: editmode ? compactview : true}, config));

if ( config.isEdit || config.isRestrictedEdit) {
me.toolbar.setMode(config);
Expand Down Expand Up @@ -1300,8 +1306,10 @@ define([
viewtab.setApi(me.api).setConfig({toolbar: me, mode: config});
var $panel = viewtab.createToolbarPanel();
if ($panel) {
var visible = Common.UI.LayoutManager.isElementVisible('toolbar-view');
me.toolbar.addTab(tab, $panel, 8);
me.toolbar.setVisible('view', Common.UI.LayoutManager.isElementVisible('toolbar-view'));
me.toolbar.setVisible('view', visible);
!editmode && !compactview && visible && Common.Utils.InternalSettings.set('toolbar-active-tab', 'view'); // need to activate later
}

if (config.isPDFEdit) {
Expand Down
3 changes: 3 additions & 0 deletions apps/pdfeditor/main/app/controller/ViewTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ define([
}, 0);
}
}

if (Common.Utils.InternalSettings.get('toolbar-active-tab')==='view')
Common.NotificationCenter.trigger('tab:set-active', 'view');
});
}
},
Expand Down
33 changes: 20 additions & 13 deletions apps/presentationeditor/main/app/controller/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ define([
Common.NotificationCenter.on('toolbar:collapse', _.bind(function () {
this.toolbar.collapse();
}, this));

Common.NotificationCenter.on('tab:set-active', _.bind(function(action){
this.toolbar.setTab(action);
this.onChangeCompactView(null, false, true);
}, this));

var me = this;

var checkInsertAutoshape = function(e) {
Expand Down Expand Up @@ -475,13 +479,14 @@ define([
Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this));
},

onChangeCompactView: function(view, compact) {
onChangeCompactView: function(view, compact, suppressSave) {
this.toolbar.setFolded(compact);
this.toolbar.fireEvent('view:compact', [this.toolbar, compact]);

compact && this.onTabCollapse();

Common.localStorage.setBool('pe-compact-toolbar', compact);
!suppressSave && Common.localStorage.setBool(this.mode.isEdit ? "pe-compact-toolbar" : "pe-view-compact-toolbar", compact);

Common.NotificationCenter.trigger('layout:changed', 'toolbar');
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
Expand Down Expand Up @@ -2718,16 +2723,16 @@ define([
onAppShowed: function (config) {
var me = this;

var compactview = !config.isEdit;
if ( config.isEdit ) {
if ( Common.localStorage.itemExists("pe-compact-toolbar") ) {
compactview = Common.localStorage.getBool("pe-compact-toolbar");
} else
if ( config.customization && config.customization.compactToolbar )
compactview = true;

var editmode = config.isEdit,
compactview = !editmode;
if ( Common.localStorage.itemExists(editmode ? "pe-compact-toolbar" : "pe-view-compact-toolbar") ) {
compactview = Common.localStorage.getBool(editmode ? "pe-compact-toolbar" : "pe-view-compact-toolbar");
} else if (config.customization) {
compactview = editmode ? !!config.customization.compactToolbar : config.customization.compactToolbar!==false;
}
me.toolbar.render(_.extend({compactview: compactview}, config));
Common.Utils.InternalSettings.set('toolbar-active-tab', !editmode && !compactview);

me.toolbar.render(_.extend({compactview: editmode ? compactview : true}, config));

var tab = {action: 'review', caption: me.toolbar.textTabCollaboration, layoutname: 'toolbar-collaboration', dataHintTitle: 'U'};
var $panel = me.getApplication().getController('Common.Controllers.ReviewChanges').createToolbarPanel();
Expand Down Expand Up @@ -2790,8 +2795,10 @@ define([
viewtab.setApi(me.api).setConfig({toolbar: me, mode: config});
$panel = viewtab.createToolbarPanel();
if ($panel) {
var visible = Common.UI.LayoutManager.isElementVisible('toolbar-view');
me.toolbar.addTab(tab, $panel, 7);
me.toolbar.setVisible('view', Common.UI.LayoutManager.isElementVisible('toolbar-view'));
me.toolbar.setVisible('view', visible);
!editmode && !compactview && visible && Common.Utils.InternalSettings.set('toolbar-active-tab', 'view'); // need to activate later
}
},

Expand Down
3 changes: 3 additions & 0 deletions apps/presentationeditor/main/app/view/ViewTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,9 @@ define([
me.chRightMenu.setValue(!Common.localStorage.getBool("pe-hidden-rightmenu", value));

me.setEvents();

if (Common.Utils.InternalSettings.get('toolbar-active-tab')==='view')
Common.NotificationCenter.trigger('tab:set-active', 'view');
});
},

Expand Down
31 changes: 20 additions & 11 deletions apps/spreadsheeteditor/main/app/controller/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ define([
this.toolbar.collapse();
}, this));
Common.NotificationCenter.on('oleedit:close', _.bind(this.onOleEditClose, this));
Common.NotificationCenter.on('tab:set-active', _.bind(function(action){
this.toolbar.setTab(action);
this.onChangeViewMode(null, false, true);
}, this));

this.editMode = true;
this._isAddingShape = false;
Expand Down Expand Up @@ -2201,12 +2205,13 @@ define([
Common.NotificationCenter.on('cells:range', _.bind(this.onCellsRange, this));
},

onChangeViewMode: function(item, compact) {
onChangeViewMode: function(item, compact, suppressSave) {
this.toolbar.setFolded(compact);
this.toolbar.fireEvent('view:compact', [this, compact]);
compact && this.onTabCollapse();

Common.localStorage.setBool('sse-compact-toolbar', compact);
!suppressSave && Common.localStorage.setBool(this.mode.isEdit ? "sse-compact-toolbar" : "sse-view-compact-toolbar", compact);

Common.NotificationCenter.trigger('layout:changed', 'toolbar');
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
Expand Down Expand Up @@ -4514,16 +4519,18 @@ define([
var me = this;
me.appConfig = config;

var compactview = !config.isEdit;
if ( config.isEdit && !config.isEditDiagram && !config.isEditMailMerge && !config.isEditOle ) {
if ( Common.localStorage.itemExists("sse-compact-toolbar") ) {
compactview = Common.localStorage.getBool("sse-compact-toolbar");
} else
if ( config.customization && config.customization.compactToolbar )
compactview = true;
var editmode = config.isEdit,
compactview = !editmode;
if (!config.isEditDiagram && !config.isEditMailMerge && !config.isEditOle) {
if ( Common.localStorage.itemExists(editmode ? "sse-compact-toolbar" : "sse-view-compact-toolbar") ) {
compactview = Common.localStorage.getBool(editmode ? "sse-compact-toolbar" : "sse-view-compact-toolbar");
} else if (config.customization) {
compactview = editmode ? !!config.customization.compactToolbar : config.customization.compactToolbar!==false;
}
Common.Utils.InternalSettings.set('toolbar-active-tab', !editmode && !compactview);
}

me.toolbar.render(_.extend({isCompactView: compactview}, config));
me.toolbar.render(_.extend({isCompactView: editmode ? compactview : true}, config));

if ( !config.isEditDiagram && !config.isEditMailMerge && !config.isEditOle ) {
var tab = {action: 'review', caption: me.toolbar.textTabCollaboration, layoutname: 'toolbar-collaboration', dataHintTitle: 'U'};
Expand Down Expand Up @@ -4621,8 +4628,10 @@ define([
viewtab.setApi(me.api).setConfig({toolbar: me, mode: config});
var $panel = viewtab.createToolbarPanel();
if ($panel) {
var visible = Common.UI.LayoutManager.isElementVisible('toolbar-view');
me.toolbar.addTab(tab, $panel, 8);
me.toolbar.setVisible('view', Common.UI.LayoutManager.isElementVisible('toolbar-view'));
me.toolbar.setVisible('view', visible);
!editmode && !compactview && visible && Common.Utils.InternalSettings.set('toolbar-active-tab', 'view'); // need to activate later
}
config.isEdit && Array.prototype.push.apply(me.toolbar.lockControls, viewtab.getView('ViewTab').getButtons());
}
Expand Down
3 changes: 3 additions & 0 deletions apps/spreadsheeteditor/main/app/view/ViewTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,9 @@ define([
me.chRightMenu.setValue(!Common.localStorage.getBool("sse-hidden-rightmenu", value));

setEvents.call(me);

if (Common.Utils.InternalSettings.get('toolbar-active-tab')==='view')
Common.NotificationCenter.trigger('tab:set-active', 'view');
});
},

Expand Down
Loading

0 comments on commit a6c8c83

Please sign in to comment.