From 50b957e6b5ff215230aacc50143c1613f88a96f6 Mon Sep 17 00:00:00 2001 From: Pluto Date: Mon, 7 Apr 2025 01:41:33 +0530 Subject: [PATCH] feat: add preferences to toggle the working set visibility --- src/nls/root/strings.js | 3 +++ src/project/SidebarView.js | 36 +++++++++++++++++++++++++++--------- src/styles/brackets.less | 5 +++++ 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/nls/root/strings.js b/src/nls/root/strings.js index 7b996f7da4..2c572819d3 100644 --- a/src/nls/root/strings.js +++ b/src/nls/root/strings.js @@ -1278,6 +1278,9 @@ define({ // Emmet "DESCRIPTION_EMMET": "true to enable Emmet, else false.", + // Hide/Show working set (that is displayed in the sidebar) + "DESCRIPTION_HIDE_WORKING_SET": "true to hide the working set, false to display it.", + // Tabbar "DESCRIPTION_TABBAR": "Set the tab bar settings.", "DESCRIPTION_SHOW_TABBAR": "true to show the tab bar, else false.", diff --git a/src/project/SidebarView.js b/src/project/SidebarView.js index fb609cfbe6..4622f49c4f 100644 --- a/src/project/SidebarView.js +++ b/src/project/SidebarView.js @@ -38,15 +38,16 @@ define(function (require, exports, module) { - var AppInit = require("utils/AppInit"), - ProjectManager = require("project/ProjectManager"), - WorkingSetView = require("project/WorkingSetView"), - MainViewManager = require("view/MainViewManager"), - CommandManager = require("command/CommandManager"), - Commands = require("command/Commands"), - Strings = require("strings"), - Resizer = require("utils/Resizer"), - _ = require("thirdparty/lodash"); + var AppInit = require("utils/AppInit"), + ProjectManager = require("project/ProjectManager"), + PreferencesManager = require("preferences/PreferencesManager"), + WorkingSetView = require("project/WorkingSetView"), + MainViewManager = require("view/MainViewManager"), + CommandManager = require("command/CommandManager"), + Commands = require("command/Commands"), + Strings = require("strings"), + Resizer = require("utils/Resizer"), + _ = require("thirdparty/lodash"); // These vars are initialized by the htmlReady handler // below since they refer to DOM elements @@ -244,6 +245,23 @@ define(function (require, exports, module) { // Tooltips $splitViewMenu.attr("title", Strings.GEAR_MENU_TOOLTIP); + + // Define the preference to decide whether to hide the working set or not + PreferencesManager.definePreference("hideWorkingSet", "boolean", false, { + description: Strings.DESCRIPTION_HIDE_WORKING_SET + }) + .on("change", function () { + // 'working-set-list-container' is the id of the main working set element which we need to hide/show + const $workingSet = $(document.getElementById("working-set-list-container")); + const getPref = PreferencesManager.get("hideWorkingSet"); + + if(getPref) { + // refer to brackets.less file for styles + $workingSet.addClass("working-set-hidden"); + } else { + $workingSet.removeClass("working-set-hidden"); + } + }); }); ProjectManager.on("projectOpen", _updateProjectTitle); diff --git a/src/styles/brackets.less b/src/styles/brackets.less index 6b4b43a611..86b69b1203 100644 --- a/src/styles/brackets.less +++ b/src/styles/brackets.less @@ -1167,12 +1167,17 @@ a, img { #working-set-list-container { background: @bc-sidebar-bg; + display: block; > div:last-child ul { padding-bottom: 21px; // Adds working set bottom padding to the last UL. } } +#working-set-list-container.working-set-hidden { + display: none !important; +} + .working-set-header { position: relative; height: 19px;