Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 21 additions & 43 deletions src/command/Menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,29 +525,7 @@ define(function (require, exports, module) {
var $relativeElement = this._getRelativeMenuItem(relativeID, position);
_insertInList($("li#" + StringUtils.jQueryIdEscape(this.id) + " > ul.dropdown-menu"),
$menuItem, position, $relativeElement);
}

// Initialize MenuItem state
if (!menuItem.isDivider) {
if (keyBindings) {
// Add key bindings. The MenuItem listens to the Command object to update MenuItem DOM with shortcuts.
if (!Array.isArray(keyBindings)) {
keyBindings = [keyBindings];
}
}

// Note that keyBindings passed during MenuItem creation take precedent over any existing key bindings
KeyBindingManager.addBinding(commandID, keyBindings);

// Look for existing key bindings
_addExistingKeyBinding(menuItem, commandID);

menuItem._checkedChanged();
menuItem._enabledChanged();
menuItem._nameChanged();
}

if (!_isHTMLMenu(this.id)) {
} else {
var bindings = KeyBindingManager.getKeyBindings(commandID),
binding,
bindingStr = "",
Expand Down Expand Up @@ -575,30 +553,30 @@ define(function (require, exports, module) {
brackets.app.addMenuItem(this.id, name, commandID, bindingStr, displayStr, position, relativeID, function (err) {
if (err) {
console.error("addMenuItem() -- error: " + err + " when adding command: " + commandID);
} else {
// Make sure the name and shortcut are up to date
if (!menuItem.isDivider) {
brackets.app.setMenuTitle(commandID, name, function (err) {
if (err) {
console.error("setMenuTitle() -- error: " + err + " when adding command: " + commandID);
} else {
brackets.app.setMenuItemShortcut(
commandID,
bindingStr,
displayStr,
function (err) {
if (err) {
console.error("setMenuItemShortcut() -- error: " + err + " when adding command: " + commandID);
}
}
);
}
});
}
}
});
menuItem.isNative = true;
}

// Initialize MenuItem state
if (!menuItem.isDivider) {
if (keyBindings) {
// Add key bindings. The MenuItem listens to the Command object to update MenuItem DOM with shortcuts.
if (!Array.isArray(keyBindings)) {
keyBindings = [keyBindings];
}
}

// Note that keyBindings passed during MenuItem creation take precedent over any existing key bindings
KeyBindingManager.addBinding(commandID, keyBindings);

// Look for existing key bindings
_addExistingKeyBinding(menuItem, commandID);

menuItem._checkedChanged();
menuItem._enabledChanged();
menuItem._nameChanged();
}

return menuItem;
};
Expand Down