fix: revert allow disabling all NSMenuItems, fix menu crash (#48800)

Revert "fix: allow disabling all `NSMenuItems` (#48598)"

This reverts commit 0cb4fdd0f2ae28d7bf3cd753cd2b641947e637aa.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
This commit is contained in:
trop[bot] 2025-11-05 20:27:43 -08:00 committed by GitHub
commit 81332eaf65
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 50 additions and 82 deletions

View file

@ -25,30 +25,11 @@ Menu.prototype._isCommandIdChecked = function (id) {
};
Menu.prototype._isCommandIdEnabled = function (id) {
const item = this.commandsMap[id];
if (!item) return false;
const focusedWindow = BaseWindow.getFocusedWindow();
if (item.role === 'minimize' && focusedWindow) {
return focusedWindow.isMinimizable();
}
if (item.role === 'togglefullscreen' && focusedWindow) {
return focusedWindow.isFullScreenable();
}
if (item.role === 'close' && focusedWindow) {
return focusedWindow.isClosable();
}
return item.enabled;
return this.commandsMap[id] ? this.commandsMap[id].enabled : false;
};
Menu.prototype._shouldCommandIdWorkWhenHidden = function (id) {
return this.commandsMap[id]?.acceleratorWorksWhenHidden ?? false;
};
Menu.prototype._isCommandIdVisible = function (id) {
return this.commandsMap[id]?.visible ?? false;
};