diff --git a/src/command/Menus.js b/src/command/Menus.js
index 30e358df89..3bb133d192 100644
--- a/src/command/Menus.js
+++ b/src/command/Menus.js
@@ -737,6 +737,11 @@ define(function (require, exports, module) {
logger.leaveTrail("UI Menu Click: " + menuItem._command.getID());
MainViewManager.focusActivePane();
if (menuItem._command._options.eventSource) {
+ // NOTE: Ideally beforeExecuteCommand should be fired inside Command.execute itself.
+ // But right now Command.execute() bypasses the event flow
+ // So we run through CommandManager.execute() to keep things consistent
+ // (keyboard + menu both go through the same path)
+ // Read this for more info: https://github.com/phcode-dev/phoenix/pull/2356
CommandManager.execute(menuItem._command.getID(), {
eventSource: CommandManager.SOURCE_UI_MENU_CLICK,
sourceType: self.id
diff --git a/src/extensionsIntegrated/CollapseFolders/main.js b/src/extensionsIntegrated/CollapseFolders/main.js
index 98dd4f3bbb..f01ef52994 100644
--- a/src/extensionsIntegrated/CollapseFolders/main.js
+++ b/src/extensionsIntegrated/CollapseFolders/main.js
@@ -24,6 +24,7 @@
define(function (require, exports, module) {
const AppInit = require("utils/AppInit");
const ProjectManager = require("project/ProjectManager");
+ const Strings = require("strings");
/**
* This is the main function that handles the closing of all the directories
@@ -64,7 +65,7 @@ define(function (require, exports, module) {
// create the collapse btn
const $collapseBtn = $(`
-
+
diff --git a/src/extensionsIntegrated/TabBar/main.js b/src/extensionsIntegrated/TabBar/main.js
index 5f8f1b76f0..e6f6494d46 100644
--- a/src/extensionsIntegrated/TabBar/main.js
+++ b/src/extensionsIntegrated/TabBar/main.js
@@ -52,11 +52,23 @@ define(function (require, exports, module) {
let $tabBar = null;
let $tabBar2 = null;
+ /**
+ * this function checks if the TabBar is currently enabled or not (no. of tabs is 0 means tab bar is disabled)
+ * @returns {boolean} true if TabBar is enabled and should be active
+ */
+ function isTabBarActive() {
+ return Preference.tabBarEnabled && Preference.tabBarNumberOfTabs !== 0;
+ }
+
/**
* This function is responsible to take all the files from the working set and gets the working sets ready
* This is placed here instead of helper.js because it modifies the working sets
*/
function getAllFilesFromWorkingSet() {
+ if (!isTabBarActive()) {
+ return;
+ }
+
Global.firstPaneWorkingSet = [];
Global.secondPaneWorkingSet = [];
@@ -204,7 +216,7 @@ define(function (require, exports, module) {
* Creates the tab bar and adds it to the DOM
*/
function createTabBar() {
- if (!Preference.tabBarEnabled || Preference.tabBarNumberOfTabs === 0) {
+ if (!isTabBarActive()) {
cleanupTabBar();
return;
}
@@ -237,6 +249,10 @@ define(function (require, exports, module) {
* It is called when the working set changes. So instead of creating a new tab bar, we just update the existing one
*/
function updateTabs() {
+ if (!isTabBarActive()) {
+ return;
+ }
+
// Get all files from the working set. refer to `global.js`
getAllFilesFromWorkingSet();
@@ -553,6 +569,10 @@ define(function (require, exports, module) {
* @param {String} commandId - the command id, to make sure we check it do the operation only on file save
*/
function onFileSave(event, commandId) {
+ if (!isTabBarActive()) {
+ return;
+ }
+
if (commandId === Commands.FILE_SAVE || commandId === Commands.FILE_SAVE_ALL) {
const activePane = MainViewManager.getActivePaneId();
const currentFile = MainViewManager.getCurrentlyViewedFile(activePane);
@@ -632,6 +652,10 @@ define(function (require, exports, module) {
// File dirty flag change handling
DocumentManager.on("dirtyFlagChange", function (event, doc) {
+ if (!isTabBarActive()) {
+ return;
+ }
+
const filePath = doc.file.fullPath;
// Update UI
@@ -678,7 +702,7 @@ define(function (require, exports, module) {
// Update menu checkmark
CommandManager.get(Commands.TOGGLE_TABBAR).setChecked(prefs.showTabBar);
- if (Preference.tabBarEnabled && Preference.tabBarNumberOfTabs !== 0) {
+ if (isTabBarActive()) {
createTabBar();
} else {
cleanupTabBar();
diff --git a/src/nls/root/strings.js b/src/nls/root/strings.js
index 1bfb324427..2a1e50fac2 100644
--- a/src/nls/root/strings.js
+++ b/src/nls/root/strings.js
@@ -1608,6 +1608,9 @@ define({
"AI_QUOTA_USED": "AI quota used",
"LOGIN_REFRESH": "Check Login Status",
+ // Collapse Folders
+ "COLLAPSE_ALL_FOLDERS": "Collapse All Folders",
+
// Custom Snippets
"CUSTOM_SNIPPETS_MENU_ITEM_NAME": "Custom Snippets\u2026",
"CUSTOM_SNIPPETS_PANEL_TITLE": "Custom Snippets",