From 361ae458d4138bd449f89c1cb9c85d8c72d5abb3 Mon Sep 17 00:00:00 2001 From: Nikhil Mohite Date: Thu, 23 Nov 2023 15:52:00 +0530 Subject: [PATCH] Fixed an issue where on entering full screen, the option label is not changed to 'Exit Full Screen' in desktop mode. #6921 --- runtime/src/js/pgadmin.js | 25 ++++++++++--------- .../browser/static/js/MainMenuFactory.js | 1 + 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/runtime/src/js/pgadmin.js b/runtime/src/js/pgadmin.js index 8f7e62336..dd32dc53f 100644 --- a/runtime/src/js/pgadmin.js +++ b/runtime/src/js/pgadmin.js @@ -459,18 +459,19 @@ function getRuntimeMenu() { }, })); subMenus.append(new nw.MenuItem({ type: 'separator' })); - subMenus.append(new gui.MenuItem({ - label: runtimeSubMenus['enter_full_screen'].label, - enabled: runtimeSubMenus['enter_full_screen'].enable, - priority: runtimeSubMenus['enter_full_screen'].priority, - type: 'normal', - checked: false, - key: runtimeSubMenus['enter_full_screen'].key, - modifiers: runtimeSubMenus['enter_full_screen'].modifiers, - click: function () { - misc.toggleFullScreen(); - }, - })); + subMenus.append(new gui.MenuItem({ + label: pgAdminMainScreen?.isFullscreen ? runtimeSubMenus['exit_full_screen'].label : runtimeSubMenus['enter_full_screen'].label, + enabled: runtimeSubMenus['enter_full_screen'].enable, + priority: runtimeSubMenus['enter_full_screen'].priority, + type: 'normal', + checked: false, + key: runtimeSubMenus['enter_full_screen'].key, + modifiers: runtimeSubMenus['enter_full_screen'].modifiers, + click: function () { + this.label = !pgAdminMainScreen?.isFullscreen ? runtimeSubMenus['exit_full_screen'].label : runtimeSubMenus['enter_full_screen'].label; + misc.toggleFullScreen(); + }, + })); subMenus.append(new gui.MenuItem({ label: runtimeSubMenus['actual_size'].label, enabled: runtimeSubMenus['actual_size'].enable, diff --git a/web/pgadmin/browser/static/js/MainMenuFactory.js b/web/pgadmin/browser/static/js/MainMenuFactory.js index e25ff9bc0..9eacc48e4 100644 --- a/web/pgadmin/browser/static/js/MainMenuFactory.js +++ b/web/pgadmin/browser/static/js/MainMenuFactory.js @@ -35,6 +35,7 @@ if (browser == 'Nwjs') { configure: { label: gettext('Configure...'), name: 'configure', priority: 0, enable: true}, view_log: { label: gettext('View log...'), name: 'view_log', priority: 1, enable: true}, enter_full_screen: { label: gettext('Enter Full Screen'), name: 'enter_full_screen', enable: true, priority: 2, key: fullScreenKey, modifiers: isMac() ?`${controlKey}+ctrl` : controlKey}, + exit_full_screen: { label: gettext('Exit Full Screen'), name: 'exit_full_screen', enable: true, priority: 2, key: fullScreenKey, modifiers: isMac() ?`${controlKey}+ctrl` : controlKey}, actual_size: { label: gettext('Actual Size'), name: 'actual_size', priority: 3, enable: true, key: '0', modifiers: controlKey}, zoom_in: { label: gettext('Zoom In'), name: 'zoom_in', priority: 4, enable: true, key: '+', modifiers: controlKey}, zoom_out: { label: gettext('Zoom Out'), name: 'zoom_out', enable: true, priority: 5, key: '-', modifiers: controlKey},