Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/command/Menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/extensionsIntegrated/CollapseFolders/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -64,7 +65,7 @@ define(function (require, exports, module) {

// create the collapse btn
const $collapseBtn = $(`
<div id="collapse-folders" class="btn-alt-quiet" title="Collapse All">
<div id="collapse-folders" class="btn-alt-quiet" title="${Strings.COLLAPSE_ALL_FOLDERS}">
<i class="fa-solid fa-chevron-down collapse-icon" aria-hidden="true"></i>
<i class="fa-solid fa-chevron-up collapse-icon" aria-hidden="true"></i>
</div>
Expand Down
28 changes: 26 additions & 2 deletions src/extensionsIntegrated/TabBar/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 3 additions & 0 deletions src/nls/root/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading