Skip to content

Commit 9c60f6b

Browse files
committed
feat: exit design mode when opening tools panel, find-in-files, quick open, or git panel
Each of these surfaces mounts UI in a region that design mode has collapsed away (the editor chrome or the bottom panel area), so clicking into them while in design mode produced a broken layout. Call the VIEW_TOGGLE_DESIGN_MODE command to exit first; the normal command flow then renders correctly. Each site includes a TODO noting the long-term desire: float the panel / picker on top of the live preview so users can use these features without leaving design mode.
1 parent ef592f0 commit 9c60f6b

4 files changed

Lines changed: 39 additions & 1 deletion

File tree

src/extensions/default/Git/src/Main.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,20 @@ define(function (require, exports) {
4949
Branch.init();
5050
CloseNotModified.init();
5151
// Attach events
52-
$icon.on("click", Panel.toggle);
52+
$icon.on("click", function () {
53+
// Design mode collapses the editor and stretches live preview,
54+
// which leaves no room for the git bottom panel. Exit design mode
55+
// first so the panel has somewhere to render.
56+
// TODO: make git panel float/overlay live preview so users can
57+
// peek at git status without leaving design mode.
58+
const WorkspaceManager = brackets.getModule("view/WorkspaceManager");
59+
const CommandManager = brackets.getModule("command/CommandManager");
60+
const Commands = brackets.getModule("command/Commands");
61+
if (WorkspaceManager.isInDesignMode()) {
62+
CommandManager.execute(Commands.VIEW_TOGGLE_DESIGN_MODE);
63+
}
64+
Panel.toggle();
65+
});
5366
}
5467

5568
function _addRemoveItemInGitignore(selectedEntry, method) {

src/search/FindInFilesUI.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,13 @@ define(function (require, exports, module) {
191191
*/
192192
function _showFindBar(scope, showReplace) {
193193
FindUtils.notifySearchScopeChanged();
194+
// Design mode hides the editor area where the find bar and results
195+
// panel mount. Exit design mode first so the UI has somewhere to show.
196+
// TODO: make Find in Files overlay the live preview cleanly so users
197+
// can search without leaving design mode.
198+
if (WorkspaceManager.isInDesignMode()) {
199+
CommandManager.execute(Commands.VIEW_TOGGLE_DESIGN_MODE);
200+
}
194201
// If the scope is a file with a custom viewer, then we
195202
// don't show find in files dialog.
196203
if (scope && !EditorManager.canOpenPath(scope.fullPath)) {

src/search/QuickOpen.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ define(function (require, exports, module) {
4343
ProjectManager = require("project/ProjectManager"),
4444
LanguageManager = require("language/LanguageManager"),
4545
FileSystemError = require("filesystem/FileSystemError"),
46+
WorkspaceManager = require("view/WorkspaceManager"),
4647
ModalBar = require("widgets/ModalBar").ModalBar,
4748
QuickSearchField = require("search/QuickSearchField").QuickSearchField,
4849
StringMatch = require("utils/StringMatch"),
@@ -779,6 +780,14 @@ define(function (require, exports, module) {
779780
}
780781

781782
function doFileSearch() {
783+
// Design mode hides the editor area where Quick Open's modal bar and
784+
// result interactions need to land. Exit design mode first so the user
785+
// sees the picker on the normal editor chrome.
786+
// TODO: allow Quick Open to float above the live preview so users can
787+
// navigate without leaving design mode.
788+
if (WorkspaceManager.isInDesignMode()) {
789+
CommandManager.execute(Commands.VIEW_TOGGLE_DESIGN_MODE);
790+
}
782791
beginSearch("", getCurrentEditorSelectedText());
783792
}
784793

src/view/DefaultPanelView.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,15 @@ define(function (require, exports, module) {
182182
.attr("title", Strings.BOTTOM_PANEL_DEFAULT_TITLE);
183183

184184
$drawerBtn.on("click", function () {
185+
// Design mode collapses the editor and stretches live preview, which
186+
// leaves no room for the bottom tools panel. Exit design mode first
187+
// so the panel has somewhere to go.
188+
// TODO: revisit once the tools panel can float / overlay the live
189+
// preview without disrupting it, so users can peek at tools without
190+
// leaving design mode.
191+
if (WorkspaceManager.isInDesignMode()) {
192+
CommandManager.execute(Commands.VIEW_TOGGLE_DESIGN_MODE);
193+
}
185194
if (_panel.isVisible()) {
186195
_panel.hide();
187196
} else {

0 commit comments

Comments
 (0)