From 56967e23023a17cd26ff24ea899b262886d483ae Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 27 Mar 2019 16:03:16 +0300 Subject: [PATCH] [PE] Fix Bug 35682 --- .../main/app/controller/LeftMenu.js | 14 +++++++- .../main/app/view/LeftMenu.js | 35 ++++++++++++------- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js index 55024b657..6e2ab01bd 100644 --- a/apps/presentationeditor/main/app/controller/LeftMenu.js +++ b/apps/presentationeditor/main/app/controller/LeftMenu.js @@ -506,7 +506,7 @@ define([ if (panel == 'thumbs') { this.isThumbsShown = show; } else { - if (!show && this.isThumbsShown) { + if (!show && this.isThumbsShown && !this.leftMenu._state.pluginIsRunning) { this.leftMenu.btnThumbs.toggle(true, false); } } @@ -551,6 +551,14 @@ define([ if (this.api) this.api.asc_enableKeyEvents(value); if (value) $(this.leftMenu.btnAbout.el).blur(); + if (value && this.leftMenu._state.pluginIsRunning) { + this.leftMenu.panelPlugins.show(); + this.leftMenu.$el.width(Common.localStorage.getItem('pe-mainmenu-width') || MENU_SCALE_PART); + if (this.mode.canCoAuthoring) { + this.mode.canViewComments && this.leftMenu.panelComments['hide'](); + this.mode.canChat && this.leftMenu.panelChat['hide'](); + } + } }, menuFilesShowHide: function(state) { @@ -659,7 +667,9 @@ define([ this.leftMenu.btnThumbs.toggle(false, false); this.leftMenu.panelPlugins.show(); this.leftMenu.onBtnMenuClick({pressed: true, options: {action: 'plugins'}}); + this.leftMenu._state.pluginIsRunning = true; } else { + this.leftMenu._state.pluginIsRunning = false; this.leftMenu.close(); } } @@ -670,6 +680,8 @@ define([ if (this.leftMenu.btnComments.isActive() && this.api) { this.leftMenu.btnComments.toggle(false); this.leftMenu.onBtnMenuClick(this.leftMenu.btnComments); + if (this.leftMenu._state.pluginIsRunning) // hide comments panel when plugin is running + this.leftMenu.onCoauthOptions(); // focus to sdk this.api.asc_enableKeyEvents(true); diff --git a/apps/presentationeditor/main/app/view/LeftMenu.js b/apps/presentationeditor/main/app/view/LeftMenu.js index f1a0509e6..8a69138d6 100644 --- a/apps/presentationeditor/main/app/view/LeftMenu.js +++ b/apps/presentationeditor/main/app/view/LeftMenu.js @@ -83,6 +83,7 @@ define([ initialize: function () { this.minimizedMode = true; + this._state = {}; }, render: function () { @@ -172,7 +173,8 @@ define([ onBtnMenuToggle: function(btn, state) { if (state) { btn.panel['show'](); - this.$el.width(SCALE_MIN); + if (!this._state.pluginIsRunning) + this.$el.width(SCALE_MIN); if (this.btnSearch.isActive()) this.btnSearch.toggle(false); @@ -192,16 +194,22 @@ define([ return; } else if (btn.options.action == 'thumbs') { - if (this.$el.width() > SCALE_MIN) { - Common.localStorage.setItem('pe-mainmenu-width',this.$el.width()); - this.$el.width(SCALE_MIN); + if (!btn.pressed && this._state.pluginIsRunning) { + this.$el.width(Common.localStorage.getItem('pe-mainmenu-width') || MENU_SCALE_PART); + } else { + if (this.$el.width() > SCALE_MIN) { + Common.localStorage.setItem('pe-mainmenu-width',this.$el.width()); + this.$el.width(SCALE_MIN); + } + if (this._state.pluginIsRunning) // hide comments or chat panel when plugin is running + this.onCoauthOptions(); } } else { if (btn.pressed) { if (!(this.$el.width() > SCALE_MIN)) { this.$el.width(Common.localStorage.getItem('pe-mainmenu-width') || MENU_SCALE_PART); } - } else { + } else if (!this._state.pluginIsRunning){ Common.localStorage.setItem('pe-mainmenu-width',this.$el.width()); this.$el.width(SCALE_MIN); } @@ -235,12 +243,12 @@ define([ } } /** coauthoring end **/ - if (this.mode.canPlugins && this.panelPlugins) { - if (this.btnPlugins.pressed) { - this.panelPlugins.show(); - } else - this.panelPlugins['hide'](); - } + // if (this.mode.canPlugins && this.panelPlugins) { + // if (this.btnPlugins.pressed) { + // this.panelPlugins.show(); + // } else + // this.panelPlugins['hide'](); + // } }, setOptionsPanel: function(name, panel) { @@ -271,7 +279,8 @@ define([ close: function(menu) { this.btnAbout.toggle(false); this.btnThumbs.toggle(false); - this.$el.width(SCALE_MIN); + if (!this._state.pluginIsRunning) + this.$el.width(SCALE_MIN); /** coauthoring begin **/ if (this.mode.canCoAuthoring) { if (this.mode.canViewComments) { @@ -286,7 +295,7 @@ define([ } } /** coauthoring end **/ - if (this.mode.canPlugins && this.panelPlugins) { + if (this.mode.canPlugins && this.panelPlugins && !this._state.pluginIsRunning) { this.panelPlugins['hide'](); this.btnPlugins.toggle(false, true); }