From 1120a1eaa205416096c211e89874233787d8116b Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 23 Dec 2020 13:09:02 +0300 Subject: [PATCH] [DE] Change opening right panel tabs for form controls --- .../main/app/controller/RightMenu.js | 45 ++++++++++++++++++- .../documenteditor/main/app/view/RightMenu.js | 2 +- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/apps/documenteditor/main/app/controller/RightMenu.js b/apps/documenteditor/main/app/controller/RightMenu.js index 4b9fb3b64..1207e25d3 100644 --- a/apps/documenteditor/main/app/controller/RightMenu.js +++ b/apps/documenteditor/main/app/controller/RightMenu.js @@ -60,6 +60,8 @@ define([ 'rightmenuclick': this.onRightMenuClick } }); + + Common.Utils.InternalSettings.set("de-rightpanel-active-form", 1); }, onLaunch: function() { @@ -95,8 +97,29 @@ define([ this.editMode = mode.isEdit; }, - onRightMenuClick: function(menu, type, minimized) { + onRightMenuClick: function(menu, type, minimized, event) { if (!minimized && this.editMode) { + if (event) { // user click event + if (!this._settings[Common.Utils.documentSettingsType.Form].hidden) { + if (type == Common.Utils.documentSettingsType.Form) { + if (!this._settings[Common.Utils.documentSettingsType.Paragraph].hidden) + Common.Utils.InternalSettings.set("de-rightpanel-active-para", 0); + if (!this._settings[Common.Utils.documentSettingsType.Image].hidden) + Common.Utils.InternalSettings.set("de-rightpanel-active-image", 0); + if (!this._settings[Common.Utils.documentSettingsType.Shape].hidden) + Common.Utils.InternalSettings.set("de-rightpanel-active-shape", 0); + } else if (type == Common.Utils.documentSettingsType.Paragraph) { + Common.Utils.InternalSettings.set("de-rightpanel-active-para", 2); + } else if (type == Common.Utils.documentSettingsType.Image) { + Common.Utils.InternalSettings.set("de-rightpanel-active-image", 2); + Common.Utils.InternalSettings.set("de-rightpanel-active-shape", 0); + } else if (type == Common.Utils.documentSettingsType.Shape) { + Common.Utils.InternalSettings.set("de-rightpanel-active-shape", 2); + Common.Utils.InternalSettings.set("de-rightpanel-active-image", 0); + } + } + } + var panel = this._settings[type].panel; var props = this._settings[type].props; if (props && panel) @@ -223,6 +246,26 @@ define([ if (!this.rightmenu.minimizedMode || open) { var active; + if (priorityactive<0 && !this._settings[Common.Utils.documentSettingsType.Form].hidden && + (!this._settings[Common.Utils.documentSettingsType.Paragraph].hidden || !this._settings[Common.Utils.documentSettingsType.Image].hidden + || !this._settings[Common.Utils.documentSettingsType.Shape].hidden)) { + var imageactive = Common.Utils.InternalSettings.get("de-rightpanel-active-image") || 0, + shapeactive = Common.Utils.InternalSettings.get("de-rightpanel-active-shape") || 0, + paraactive = Common.Utils.InternalSettings.get("de-rightpanel-active-para") || 0, + formactive = Common.Utils.InternalSettings.get("de-rightpanel-active-form") || 0; + + if (!this._settings[Common.Utils.documentSettingsType.Paragraph].hidden) { + priorityactive = (formactive>paraactive) ? Common.Utils.documentSettingsType.Form : Common.Utils.documentSettingsType.Paragraph; + } else if (!this._settings[Common.Utils.documentSettingsType.Paragraph].Image || !this._settings[Common.Utils.documentSettingsType.Shape].hidden) { + if (formactive>shapeactive && formactive>imageactive) + priorityactive = Common.Utils.documentSettingsType.Form; + else if (shapeactive>formactive && shapeactive>imageactive) + priorityactive = Common.Utils.documentSettingsType.Shape; + else + priorityactive = Common.Utils.documentSettingsType.Image; + } + } + if (priorityactive>-1) active = priorityactive; else if (lastactive>=0 && currentactive<0) active = lastactive; else if (currentactive>=0) active = currentactive; diff --git a/apps/documenteditor/main/app/view/RightMenu.js b/apps/documenteditor/main/app/view/RightMenu.js index 778dbc362..dfadc2c5c 100644 --- a/apps/documenteditor/main/app/view/RightMenu.js +++ b/apps/documenteditor/main/app/view/RightMenu.js @@ -293,7 +293,7 @@ define([ Common.localStorage.setItem("de-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) {