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:
parent
a06d00df6c
commit
81332eaf65
2 changed files with 50 additions and 82 deletions
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue