[SSE] Remember active panel selected by user (for pivot and format tables)

This commit is contained in:
Julia Radzhabova 2020-03-27 16:46:09 +03:00
parent fbf1e817d7
commit 644c8f2bd2
3 changed files with 33 additions and 3 deletions

View file

@ -163,6 +163,7 @@ define([
api: me.api, api: me.api,
handler: function(result, settings) { handler: function(result, settings) {
if (result == 'ok' && settings) { if (result == 'ok' && settings) {
me.view && me.view.fireEvent('insertpivot', me.view);
if (settings.destination) if (settings.destination)
me.api.asc_insertPivotExistingWorksheet(settings.source, settings.destination); me.api.asc_insertPivotExistingWorksheet(settings.source, settings.destination);
else else

View file

@ -66,6 +66,9 @@ define([
}, },
'RightMenu': { 'RightMenu': {
'rightmenuclick': this.onRightMenuClick 'rightmenuclick': this.onRightMenuClick
},
'PivotTable': {
'insertpivot': this.onInsertPivot
} }
}); });
}, },
@ -103,8 +106,21 @@ define([
this.editMode = mode.isEdit; this.editMode = mode.isEdit;
}, },
onRightMenuClick: function(menu, type, minimized) { onRightMenuClick: function(menu, type, minimized, event) {
if (!minimized && this.editMode) { if (!minimized && this.editMode) {
if (event) { // user click event
if (type == Common.Utils.documentSettingsType.Table)
Common.Utils.InternalSettings.set("sse-rightpanel-active-table", 1);
else if (type == Common.Utils.documentSettingsType.Pivot)
Common.Utils.InternalSettings.set("sse-rightpanel-active-pivot", 1);
else if (Common.Utils.documentSettingsType.Cell) {
if (!this._settings[Common.Utils.documentSettingsType.Table].hidden)
Common.Utils.InternalSettings.set("sse-rightpanel-active-table", 0);
if (!this._settings[Common.Utils.documentSettingsType.Pivot].hidden)
Common.Utils.InternalSettings.set("sse-rightpanel-active-pivot", 0);
}
}
var panel = this._settings[type].panel; var panel = this._settings[type].panel;
var props = this._settings[type].props; var props = this._settings[type].props;
if (props && panel) if (props && panel)
@ -239,6 +255,14 @@ define([
if (!this.rightmenu.minimizedMode || this._openRightMenu) { if (!this.rightmenu.minimizedMode || this._openRightMenu) {
var active; var active;
if (priorityactive<0 && !this._settings[Common.Utils.documentSettingsType.Cell].hidden &&
(!this._settings[Common.Utils.documentSettingsType.Table].hidden || !this._settings[Common.Utils.documentSettingsType.Pivot].hidden)) {
if (!this._settings[Common.Utils.documentSettingsType.Table].hidden)
priorityactive = Common.Utils.InternalSettings.get("sse-rightpanel-active-table")==0 ? Common.Utils.documentSettingsType.Cell : Common.Utils.documentSettingsType.Table;
if (!this._settings[Common.Utils.documentSettingsType.Pivot].hidden)
priorityactive = Common.Utils.InternalSettings.get("sse-rightpanel-active-pivot")==0 ? Common.Utils.documentSettingsType.Cell : Common.Utils.documentSettingsType.Pivot;
}
if (priorityactive>-1) active = priorityactive; if (priorityactive>-1) active = priorityactive;
else if (lastactive>=0 && currentactive<0) active = lastactive; else if (lastactive>=0 && currentactive<0) active = lastactive;
else if (currentactive>=0) active = currentactive; else if (currentactive>=0) active = currentactive;
@ -259,6 +283,7 @@ define([
this._settings[Common.Utils.documentSettingsType.Image].needShow = false; this._settings[Common.Utils.documentSettingsType.Image].needShow = false;
this._settings[Common.Utils.documentSettingsType.Chart].needShow = false; this._settings[Common.Utils.documentSettingsType.Chart].needShow = false;
this._settings[Common.Utils.documentSettingsType.Table].needShow = false; this._settings[Common.Utils.documentSettingsType.Table].needShow = false;
this._settings[Common.Utils.documentSettingsType.Pivot].needShow = false;
}, },
onCoAuthoringDisconnect: function() { onCoAuthoringDisconnect: function() {
@ -283,7 +308,11 @@ define([
}, },
onInsertTable: function() { onInsertTable: function() {
this._settings[Common.Utils.documentSettingsType.Table].needShow = true; // this._settings[Common.Utils.documentSettingsType.Table].needShow = true;
},
onInsertPivot: function() {
// this._settings[Common.Utils.documentSettingsType.Pivot].needShow = true;
}, },
UpdateThemeColors: function() { UpdateThemeColors: function() {

View file

@ -277,7 +277,7 @@ define([
Common.localStorage.setItem("sse-hide-right-settings", 1); Common.localStorage.setItem("sse-hide-right-settings", 1);
} }
this.fireEvent('rightmenuclick', [this, btn.options.asctype, this.minimizedMode]); this.fireEvent('rightmenuclick', [this, btn.options.asctype, this.minimizedMode, e]);
}, },
SetActivePane: function(type, open) { SetActivePane: function(type, open) {