From defded0cafa7a7e815ba30d5c8babaa483042dde Mon Sep 17 00:00:00 2001 From: Sorab Bisht Date: Tue, 12 Jun 2018 23:04:42 -0700 Subject: [PATCH 1/2] Fix for FindInFiles UI not opening when no file is open (#14416) * Add null check for editor * Cleanup: Use tertiary operator --- src/search/FindBar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/search/FindBar.js b/src/search/FindBar.js index d15cdd7fe93..e655b6b763e 100644 --- a/src/search/FindBar.js +++ b/src/search/FindBar.js @@ -705,7 +705,7 @@ define(function (require, exports, module) { */ FindBar.getInitialQuery = function (currentFindBar, editor) { var query, - selection = FindBar._getInitialQueryFromSelection(editor), + selection = editor ? FindBar._getInitialQueryFromSelection(editor) : "", replaceText = ""; if (currentFindBar && !currentFindBar.isClosed()) { From 10b651b18ac766dc5ae992f76a0e4b28d37c6a28 Mon Sep 17 00:00:00 2001 From: Sorab Bisht Date: Wed, 13 Jun 2018 22:51:15 -0700 Subject: [PATCH 2/2] Fix for Title bar text and Save button issue for empty active pane (#14421) * Adding null checks to fix title change issue * Change the menu items visibility when file is present in active pane * Enable Menu options when no file is present in active pane --- src/document/DocumentCommandHandlers.js | 4 ++-- src/extensions/default/RemoteFileAdapter/main.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/document/DocumentCommandHandlers.js b/src/document/DocumentCommandHandlers.js index 618ada5adca..28ea9a9dfb0 100644 --- a/src/document/DocumentCommandHandlers.js +++ b/src/document/DocumentCommandHandlers.js @@ -158,8 +158,8 @@ define(function (require, exports, module) { var currentDoc = DocumentManager.getCurrentDocument(), windowTitle = brackets.config.app_title, currentlyViewedFile = MainViewManager.getCurrentlyViewedFile(MainViewManager.ACTIVE_PANE), - currentlyViewedPath = currentlyViewedFile.fullPath, - readOnlyString = currentlyViewedFile.readOnly ? "[Read Only] - " : ""; + currentlyViewedPath = currentlyViewedFile && currentlyViewedFile.fullPath, + readOnlyString = (currentlyViewedFile && currentlyViewedFile.readOnly) ? "[Read Only] - " : ""; if (!brackets.nativeMenus) { if (currentlyViewedPath) { diff --git a/src/extensions/default/RemoteFileAdapter/main.js b/src/extensions/default/RemoteFileAdapter/main.js index 143e7ff3c75..5feca37ce8b 100644 --- a/src/extensions/default/RemoteFileAdapter/main.js +++ b/src/extensions/default/RemoteFileAdapter/main.js @@ -59,7 +59,8 @@ define(function (require, exports, module) { function _setMenuItemsVisible() { var file = MainViewManager.getCurrentlyViewedFile(MainViewManager.ACTIVE_PANE), cMenuItems = [Commands.FILE_SAVE, Commands.FILE_RENAME, Commands.NAVIGATE_SHOW_IN_FILE_TREE, Commands.NAVIGATE_SHOW_IN_OS], - enable = (file.constructor.name !== "RemoteFile"); + // Enable menu options when no file is present in active pane + enable = !file || (file.constructor.name !== "RemoteFile"); // Enable or disable commands based on whether the file is a remoteFile or not. cMenuItems.forEach(function (item) {