From 79428de692c5cf04516d105047d41b8ae445e6da Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 9 Jun 2022 00:09:42 +0300 Subject: [PATCH] Fix click on buttons when left menu is hidden --- apps/common/main/lib/view/History.js | 5 ++++- apps/documenteditor/main/app/view/LeftMenu.js | 7 ++++++- apps/presentationeditor/main/app/view/LeftMenu.js | 6 +++++- apps/spreadsheeteditor/main/app/view/LeftMenu.js | 6 +++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/apps/common/main/lib/view/History.js b/apps/common/main/lib/view/History.js index 5c79d22b9..b8ec54273 100644 --- a/apps/common/main/lib/view/History.js +++ b/apps/common/main/lib/view/History.js @@ -68,11 +68,14 @@ define([ initialize: function(options) { _.extend(this, options); Common.UI.BaseView.prototype.initialize.call(this, arguments); + + var filter = Common.localStorage.getKeysFilter(); + this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : ''; }, render: function(el) { el = el || this.el; - $(el).html(this.template({scope: this})).width( (parseInt(Common.localStorage.getItem('de-mainmenu-width')) || MENU_SCALE_PART) - SCALE_MIN); + $(el).html(this.template({scope: this})).width( (parseInt(Common.localStorage.getItem(this.appPrefix + 'mainmenu-width')) || MENU_SCALE_PART) - SCALE_MIN); this.viewHistoryList = new Common.UI.DataView({ el: $('#history-list'), diff --git a/apps/documenteditor/main/app/view/LeftMenu.js b/apps/documenteditor/main/app/view/LeftMenu.js index b0efb77f3..d6b13128c 100644 --- a/apps/documenteditor/main/app/view/LeftMenu.js +++ b/apps/documenteditor/main/app/view/LeftMenu.js @@ -202,7 +202,7 @@ define([ this.$el.width(parseInt(Common.localStorage.getItem('de-mainmenu-width')) || MENU_SCALE_PART); } } else if (!this._state.pluginIsRunning) { - Common.localStorage.setItem('de-mainmenu-width',this.$el.width()); + this.isVisible() && Common.localStorage.setItem('de-mainmenu-width',this.$el.width()); this.$el.width(SCALE_MIN); } @@ -497,6 +497,11 @@ define([ } this.limitHint && this.limitHint.css('top', top); }, + + isVisible: function () { + return this.$el && this.$el.is(':visible'); + }, + /** coauthoring begin **/ tipComments : 'Comments', tipChat : 'Chat', diff --git a/apps/presentationeditor/main/app/view/LeftMenu.js b/apps/presentationeditor/main/app/view/LeftMenu.js index 02d0ea6f8..0095d4959 100644 --- a/apps/presentationeditor/main/app/view/LeftMenu.js +++ b/apps/presentationeditor/main/app/view/LeftMenu.js @@ -195,7 +195,7 @@ define([ this.$el.width(Common.localStorage.getItem('pe-mainmenu-width') || MENU_SCALE_PART); } } else if (!this._state.pluginIsRunning){ - Common.localStorage.setItem('pe-mainmenu-width',this.$el.width()); + this.isVisible() && Common.localStorage.setItem('pe-mainmenu-width',this.$el.width()); this.$el.width(SCALE_MIN); } this.onCoauthOptions(); @@ -453,6 +453,10 @@ define([ Common.NotificationCenter.trigger('layout:changed', 'history'); }, + isVisible: function () { + return this.$el && this.$el.is(':visible'); + }, + /** coauthoring begin **/ tipComments : 'Comments', tipChat : 'Chat', diff --git a/apps/spreadsheeteditor/main/app/view/LeftMenu.js b/apps/spreadsheeteditor/main/app/view/LeftMenu.js index eb88e6eea..b9540ad44 100644 --- a/apps/spreadsheeteditor/main/app/view/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/view/LeftMenu.js @@ -179,7 +179,7 @@ define([ this.$el.width(Common.localStorage.getItem('sse-mainmenu-width') || MENU_SCALE_PART); } } else if (!this._state.pluginIsRunning){ - Common.localStorage.setItem('sse-mainmenu-width',this.$el.width()); + this.isVisible() && Common.localStorage.setItem('sse-mainmenu-width',this.$el.width()); this.$el.width(SCALE_MIN); } this.onCoauthOptions(); @@ -439,6 +439,10 @@ define([ Common.NotificationCenter.trigger('layout:changed', 'history'); }, + isVisible: function () { + return this.$el && this.$el.is(':visible'); + }, + /** coauthoring begin **/ tipComments : 'Comments', tipChat : 'Chat',