diff --git a/apps/documenteditor/main/app/controller/RightMenu.js b/apps/documenteditor/main/app/controller/RightMenu.js index 1261c0156..b162d3c5d 100644 --- a/apps/documenteditor/main/app/controller/RightMenu.js +++ b/apps/documenteditor/main/app/controller/RightMenu.js @@ -463,7 +463,8 @@ define([ } else { var selectedElements = this.api.getSelectedElements(); if (selectedElements.length > 0) - this.onFocusObject(selectedElements, false, !Common.Utils.InternalSettings.get("de-hide-right-settings")); + this.onFocusObject(selectedElements, false, !Common.Utils.InternalSettings.get("de-hide-right-settings") && // user didn't close panel + !Common.Utils.InternalSettings.get("de-hidden-rightmenu")); // user didn't hide right menu } } }, @@ -496,11 +497,17 @@ define([ } }, - onRightMenuHide: function (view, status) { + onRightMenuHide: function (view, status) { // status = true when show panel if (this.rightmenu) { !status && this.rightmenu.clearSelection(); status ? this.rightmenu.show() : this.rightmenu.hide(); Common.localStorage.setBool('de-hidden-rightmenu', !status); + Common.Utils.InternalSettings.set("de-hidden-rightmenu", !status); + if (status) { + var selectedElements = this.api.getSelectedElements(); + if (selectedElements.length > 0) + this.onFocusObject(selectedElements, false, !Common.Utils.InternalSettings.get("de-hide-right-settings")); + } } Common.NotificationCenter.trigger('layout:changed', 'main'); diff --git a/apps/documenteditor/main/app/view/Viewport.js b/apps/documenteditor/main/app/view/Viewport.js index 2ee5fcc65..799325fd3 100644 --- a/apps/documenteditor/main/app/view/Viewport.js +++ b/apps/documenteditor/main/app/view/Viewport.js @@ -144,6 +144,7 @@ define([ var value = Common.UI.LayoutManager.getInitValue('rightMenu'); value = (value!==undefined) ? !value : false; Common.localStorage.getBool("de-hidden-rightmenu", value) && me._rightMenu.hide(); + Common.Utils.InternalSettings.set("de-hidden-rightmenu", Common.localStorage.getBool("de-hidden-rightmenu", value)); }, applyCommonMode: function() { diff --git a/apps/presentationeditor/main/app/controller/RightMenu.js b/apps/presentationeditor/main/app/controller/RightMenu.js index 4e5c5a0ba..b99aea26c 100644 --- a/apps/presentationeditor/main/app/controller/RightMenu.js +++ b/apps/presentationeditor/main/app/controller/RightMenu.js @@ -117,11 +117,11 @@ define([ this.rightmenu.fireEvent('editcomplete', this.rightmenu); }, - onFocusObject: function(SelectedObjects, forceSignature) { + onFocusObject: function(SelectedObjects, forceSignature, forceOpen) { if (!this.editMode && !forceSignature) return; - var open = this._initSettings ? !Common.localStorage.getBool("pe-hide-right-settings", this.rightmenu.defaultHideRightMenu) : false; + var open = this._initSettings ? !Common.localStorage.getBool("pe-hide-right-settings", this.rightmenu.defaultHideRightMenu) : !!forceOpen; this._initSettings = false; var needhide = true; @@ -206,13 +206,19 @@ define([ if (!this.rightmenu.minimizedMode || open) { var active; - if (priorityactive<0 && this._priorityArr.length>0) { - for (i=0; i0) { + for (i=0; i 0) - this.onFocusObject(selectedElements); + this.onFocusObject(selectedElements, false, !Common.Utils.InternalSettings.get("pe-hide-right-settings") && + !Common.Utils.InternalSettings.get("pe-hidden-rightmenu")); } } }, @@ -391,9 +398,29 @@ define([ onRightMenuHide: function (view, status) { if (this.rightmenu) { - !status && this.rightmenu.clearSelection(); - status ? this.rightmenu.show() : this.rightmenu.hide(); + if (!status) { // remember last active pane + var active = this.rightmenu.GetActivePane(), + type; + if (active) { + for (var i=0; i 0) + this.onFocusObject(selectedElements, false, !Common.Utils.InternalSettings.get("pe-hide-right-settings")); + this._lastVisibleSettings = undefined; + } Common.localStorage.setBool('pe-hidden-rightmenu', !status); + Common.Utils.InternalSettings.set("pe-hidden-rightmenu", !status); } Common.NotificationCenter.trigger('layout:changed', 'main'); diff --git a/apps/presentationeditor/main/app/view/RightMenu.js b/apps/presentationeditor/main/app/view/RightMenu.js index 83289892e..b2d973af7 100644 --- a/apps/presentationeditor/main/app/view/RightMenu.js +++ b/apps/presentationeditor/main/app/view/RightMenu.js @@ -151,6 +151,7 @@ define([ this.defaultHideRightMenu = mode.customization && !!mode.customization.hideRightMenu; var open = !Common.localStorage.getBool("pe-hide-right-settings", this.defaultHideRightMenu); + Common.Utils.InternalSettings.set("pe-hide-right-settings", !open); el.css('width', ((open) ? MENU_SCALE_PART : SCALE_MIN) + 'px'); el.show(); @@ -243,6 +244,7 @@ define([ target_pane_parent.css("display", "inline-block" ); this.minimizedMode = false; Common.localStorage.setItem("pe-hide-right-settings", 0); + Common.Utils.InternalSettings.set("pe-hide-right-settings", false); } target_pane_parent.find('> .active').removeClass('active'); target_pane.addClass("active"); @@ -256,6 +258,7 @@ define([ $(this.el).width(SCALE_MIN); this.minimizedMode = true; Common.localStorage.setItem("pe-hide-right-settings", 1); + Common.Utils.InternalSettings.set("pe-hide-right-settings", true); } this.fireEvent('rightmenuclick', [this, btn.options.asctype, this.minimizedMode, e]); diff --git a/apps/presentationeditor/main/app/view/Viewport.js b/apps/presentationeditor/main/app/view/Viewport.js index 3e2a288a1..029f5fc1f 100644 --- a/apps/presentationeditor/main/app/view/Viewport.js +++ b/apps/presentationeditor/main/app/view/Viewport.js @@ -145,6 +145,7 @@ define([ var value = Common.UI.LayoutManager.getInitValue('rightMenu'); value = (value!==undefined) ? !value : false; Common.localStorage.getBool("pe-hidden-rightmenu", value) && me._rightMenu.hide(); + Common.Utils.InternalSettings.set("pe-hidden-rightmenu", Common.localStorage.getBool("pe-hidden-rightmenu", value)); }, applyCommonMode: function() { diff --git a/apps/spreadsheeteditor/main/app/controller/RightMenu.js b/apps/spreadsheeteditor/main/app/controller/RightMenu.js index a406c4875..4c0c0a670 100644 --- a/apps/spreadsheeteditor/main/app/controller/RightMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/RightMenu.js @@ -281,6 +281,12 @@ define([ if (!this.rightmenu.minimizedMode || this._openRightMenu) { var active; + if (priorityactive<0 && this._lastVisibleSettings!==undefined) { + var pnl = this._settings[this._lastVisibleSettings]; + if (pnl!==undefined && pnl.btn!==undefined && pnl.panel!==undefined && !pnl.hidden) + priorityactive = this._lastVisibleSettings; + } + if (priorityactive<0 && !this._settings[Common.Utils.documentSettingsType.Cell].hidden && (!this._settings[Common.Utils.documentSettingsType.Table].hidden || !this._settings[Common.Utils.documentSettingsType.Pivot].hidden || !this._settings[Common.Utils.documentSettingsType.Chart].hidden)) { @@ -372,7 +378,8 @@ define([ var me = this; if (this.api) { this._openRightMenu = !Common.localStorage.getBool("sse-hide-right-settings", this.rightmenu.defaultHideRightMenu); - + Common.Utils.InternalSettings.set("sse-hide-right-settings", !this._openRightMenu); + this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onSelectionChanged, this)); this.api.asc_registerCallback('asc_doubleClickOnObject', _.bind(this.onDoubleClickOnObject, this)); // this.rightmenu.shapeSettings.createDelayedElements(); @@ -473,8 +480,26 @@ define([ onRightMenuHide: function (view, status) { if (this.rightmenu) { - !status && this.rightmenu.clearSelection(); - status ? this.rightmenu.show() : this.rightmenu.hide(); + if (!status) { // remember last active pane + var active = this.rightmenu.GetActivePane(), + type; + if (active) { + for (var i=0; i .active').removeClass('active'); target_pane.addClass("active"); @@ -292,6 +294,7 @@ define([ $(this.el).width(SCALE_MIN); this.minimizedMode = true; Common.localStorage.setItem("sse-hide-right-settings", 1); + Common.Utils.InternalSettings.set("sse-hide-right-settings", true); } this.fireEvent('rightmenuclick', [this, btn.options.asctype, this.minimizedMode, e]);