Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit af8146a

Browse files
committed
Merge pull request #6484 from lkcampbell/fix-6435
Remove menus for all reloads, after save dialog completes
2 parents 85dfb20 + 3942e18 commit af8146a

File tree

1 file changed

+24
-19
lines changed
  • src/extensions/default/DebugCommands

1 file changed

+24
-19
lines changed

src/extensions/default/DebugCommands/main.js

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ define(function (require, exports, module) {
150150

151151
// Disable the cache to make reloads work
152152
disableCache().always(function () {
153+
// Remove all menus to assure every part of Brackets is reloaded
154+
_.forEach(Menus.getAllMenus(), function (value, key) {
155+
Menus.removeMenu(key);
156+
});
157+
153158
window.location.href = href;
154159
});
155160
});
@@ -174,32 +179,32 @@ define(function (require, exports, module) {
174179
href += "?" + params.toString();
175180
}
176181

177-
browserReload(href);
182+
// Give Mac native menus extra time to update shortcut highlighting.
183+
// Prevents the menu highlighting from getting messed up after reload.
184+
window.setTimeout(function () {
185+
browserReload(href);
186+
}, 100);
178187
}
179188

180189
function handleReloadWithoutUserExts() {
181190
var href = window.location.href,
182191
params = new UrlParams();
183192

184-
// Give Mac native menus extra time to update shortcut highlighting prior
185-
// to removing menus, or else the highlights get messed up after the reload.
193+
params.parse();
194+
195+
if (!params.get("reloadWithoutUserExts")) {
196+
params.put("reloadWithoutUserExts", true);
197+
}
198+
199+
if (href.indexOf("?") !== -1) {
200+
href = href.substring(0, href.indexOf("?"));
201+
}
202+
203+
href += "?" + params.toString();
204+
205+
// Give Mac native menus extra time to update shortcut highlighting.
206+
// Prevents the menu highlighting from getting messed up after reload.
186207
window.setTimeout(function () {
187-
// Remove all menus to assure extension menus and menu items are removed
188-
_.forEach(Menus.getAllMenus(), function (value, key) {
189-
Menus.removeMenu(key);
190-
});
191-
192-
params.parse();
193-
194-
if (!params.get("reloadWithoutUserExts")) {
195-
params.put("reloadWithoutUserExts", true);
196-
}
197-
198-
if (href.indexOf("?") !== -1) {
199-
href = href.substring(0, href.indexOf("?"));
200-
}
201-
202-
href += "?" + params.toString();
203208
browserReload(href);
204209
}, 100);
205210
}

0 commit comments

Comments
 (0)