diff --git a/menus/base.cson b/menus/base.cson index 7a991d552..64a45e615 100644 --- a/menus/base.cson +++ b/menus/base.cson @@ -7,12 +7,11 @@ { label: "Install update", command: 'application:install-update', visible: false } { type: 'separator' } { label: 'Preferences...', command: 'application:show-settings' } + { type: 'separator' } { label: 'Hide Atom', command: 'application:hide' } { label: 'Hide Others', command: 'application:hide-other-applications' } { label: 'Show All', command: 'application:unhide-all-applications' } { type: 'separator' } - { label: 'Run Atom Specs', command: 'application:run-all-specs' } - { type: 'separator' } { label: 'Quit', command: 'application:quit' } ] } @@ -21,10 +20,15 @@ submenu: [ { label: 'New Window', command: 'application:new-window' } { label: 'New File', command: 'application:new-file' } - { type: 'separator' } { label: 'Open...', command: 'application:open' } - { label: 'Open In Dev Mode...', command: 'application:open-dev' } + { label: 'Reopen Last Item', command: 'pane:reopen-closed-item' } { type: 'separator' } + { label: 'Save', command: 'core:save' } + { label: 'Save As...', command: 'core:save-as' } + { label: 'Save All', command: 'window:save-all' } + { type: 'separator' } + { label: 'Close Buffer', command: 'core:close' } + { label: 'Close All Buffers', command: 'pane:close' } { label: 'Close Window', command: 'window:close' } ] } @@ -37,8 +41,10 @@ { type: 'separator' } { label: 'Cut', command: 'core:cut' } { label: 'Copy', command: 'core:copy' } + { label: 'Copy Path', command: 'editor:copy-path' } { label: 'Paste', command: 'core:paste' } { label: 'Select All', command: 'core:select-all' } + { type: 'separator' } ] } @@ -47,7 +53,17 @@ submenu: [ { label: 'Reload', command: 'window:reload' } { label: 'Toggle Full Screen', command: 'window:toggle-full-screen' } - { label: 'Toggle Developer Tools', command: 'window:toggle-dev-tools' } + { + label: 'Developer' + submenu: [ + { label: 'Open In Dev Mode...', command: 'application:open-dev' } + { label: 'Run Atom Specs', command: 'application:run-all-specs' } + { label: 'Run Package Specs', command: 'window:run-package-specs' } + { label: 'Toggle Developer Tools', command: 'window:toggle-dev-tools' } + ] + } + { type: 'separator' } + { label: 'Toggle Soft Wrap', command: 'editor:toggle-soft-wrap' } ] } @@ -60,4 +76,13 @@ { label: 'Bring All to Front', command: 'application:bring-all-windows-to-front' } ] } + + { + label: 'Help' + submenu: [ + { label: 'Documentation', command: 'application:open-documentation' } + { label: 'Report an Issue', command: 'application:report-issue' } + { type: 'separator' } + ] + } ] diff --git a/package.json b/package.json index 19b1526da..5a7c3eeeb 100644 --- a/package.json +++ b/package.json @@ -50,41 +50,41 @@ "archive-view": "0.11.0", "autocomplete": "0.10.0", - "autoflow": "0.4.0", - "bookmarks": "0.7.0", + "autoflow": "0.5.0", + "bookmarks": "0.8.0", "bracket-matcher": "0.7.0", "collaboration": "0.26.0", - "command-logger": "0.5.0", + "command-logger": "0.6.0", "command-palette": "0.5.0", - "dev-live-reload": "0.7.0", - "editor-stats": "0.4.0", + "dev-live-reload": "0.8.0", + "editor-stats": "0.5.0", "exception-reporting": "0.4.0", - "find-and-replace": "0.28.0", - "fuzzy-finder": "0.14.0", + "find-and-replace": "0.29.0", + "fuzzy-finder": "0.15.0", "gfm": "0.5.0", "git-diff": "0.11.0", - "gists": "0.4.0", - "github-sign-in": "0.7.0", - "go-to-line": "0.7.0", - "grammar-selector": "0.6.0", + "gists": "0.5.0", + "github-sign-in": "0.8.0", + "go-to-line": "0.8.0", + "grammar-selector": "0.7.0", "image-view": "0.7.0", "link": "0.6.0", - "markdown-preview": "0.8.0", + "markdown-preview": "0.9.0", "metrics": "0.8.0", - "package-generator": "0.12.0", - "release-notes": "0.4.0", + "package-generator": "0.13.0", + "release-notes": "0.6.0", "settings-view": "0.29.0", - "snippets": "0.9.0", + "snippets": "0.10.0", "spell-check": "0.7.0", "status-bar": "0.14.0", - "styleguide": "0.8.0", - "symbols-view": "0.11.0", + "styleguide": "0.9.0", + "symbols-view": "0.12.0", "tabs": "0.7.0", - "terminal": "0.12.0", - "timecop": "0.5.0", - "to-the-hubs": "0.7.0", + "terminal": "0.13.0", + "timecop": "0.6.0", + "to-the-hubs": "0.8.0", "toml": "0.3.0", - "tree-view": "0.18.0", + "tree-view": "0.19.0", "whitespace": "0.7.0", "wrap-guide": "0.4.0", diff --git a/spec/atom-spec.coffee b/spec/atom-spec.coffee index 396a497a1..ed357c0fe 100644 --- a/spec/atom-spec.coffee +++ b/spec/atom-spec.coffee @@ -171,6 +171,7 @@ describe "the `atom` global", -> atom.activatePackage("package-with-menus") + expect(atom.menu.template.length).toBe 2 expect(atom.menu.template[0].label).toBe "Second to Last" expect(atom.menu.template[1].label).toBe "Last" expect(atom.contextMenu.definitionsForElement(element)[0].label).toBe "Menu item 1" diff --git a/spec/fixtures/packages/package-with-menus/menus/menu-3.cson b/spec/fixtures/packages/package-with-menus/menus/menu-3.cson index 83b77430a..932cd4d5b 100644 --- a/spec/fixtures/packages/package-with-menus/menus/menu-3.cson +++ b/spec/fixtures/packages/package-with-menus/menus/menu-3.cson @@ -1,3 +1,7 @@ +'menu': [ + { 'label': 'Second to Last' } +] + 'context-menu': '.test-1': 'Menu item 3': 'command-3' diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index 0c4cf377d..2749e9247 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -111,6 +111,7 @@ afterEach -> keymap.bindingSets = bindingSetsToRestore keymap.bindingSetsByFirstKeystroke = bindingSetsByFirstKeystrokeToRestore atom.deactivatePackages() + atom.menu.template = [] window.rootView?.remove?() atom.rootView?.remove?() if atom.rootView isnt window.rootView diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 7def18e06..d51dd5157 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -4,11 +4,12 @@ AtomProtocolHandler = require './atom-protocol-handler' Menu = require 'menu' autoUpdater = require 'auto-updater' app = require 'app' -ipc = require 'ipc' dialog = require 'dialog' fs = require 'fs' +ipc = require 'ipc' path = require 'path' net = require 'net' +shell = require 'shell' url = require 'url' {EventEmitter} = require 'events' _ = require 'underscore-plus' @@ -136,6 +137,8 @@ class AtomApplication @on 'application:zoom', -> Menu.sendActionToFirstResponder('zoom:') @on 'application:bring-all-windows-to-front', -> Menu.sendActionToFirstResponder('arrangeInFront:') @on 'application:inspect', ({x,y}) -> @focusedWindow().browserWindow.inspectElement(x, y) + @on 'application:open-documentation', -> shell.openExternal('https://github-atom-io.herokuapp.com/docs/latest/?app=true') + @on 'application:report-issue', -> shell.openExternal('https://github.com/atom/atom/issues/new') @on 'application:show-settings', -> if @focusedWindow() @focusedWindow().openPath("atom://config") diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index 02b521443..7fa1f242a 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -42,10 +42,12 @@ class MenuManager # Private: Merges an item in a submenu aware way such that new items are always # appended to the bottom of existing menus where possible. merge: (menu, item) -> - if item.submenu? and match = _.find(menu, (o) -> o.submenu? and o.label == item.label) + item = _.deepClone(item) + + if item.submenu? and match = _.find(menu, (i) -> i.submenu? and i.label == item.label) @merge(match.submenu, i) for i in item.submenu else - menu.push(item) + menu.push(item) unless _.find(menu, (i) -> i.label == item.label) # Private sendToBrowserProcess: (template, keystrokesByCommand) ->