From 8941b97ed21fa99fc464dab8a407ef3f60988695 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 8 Oct 2014 11:47:46 -0700 Subject: [PATCH] =?UTF-8?q?Use=20=E2=80=98atom-workspace=E2=80=99=20custom?= =?UTF-8?q?=20tag=20name=20for=20WorkspaceElement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/creating-a-package.md | 4 ++-- keymaps/darwin.cson | 2 +- keymaps/linux.cson | 4 ++-- keymaps/win32.cson | 4 ++-- .../package-with-activation-commands/index.coffee | 2 +- .../package.json | 2 +- src/context-menu-manager.coffee | 4 ++-- src/menu-manager.coffee | 6 +++--- src/package.coffee | 10 +++++----- src/window-bootstrap.coffee | 2 +- src/workspace-element.coffee | 8 +++----- static/workspace-view.less | 2 +- 12 files changed, 24 insertions(+), 26 deletions(-) diff --git a/docs/creating-a-package.md b/docs/creating-a-package.md index a86846068..4f5cf4fc9 100644 --- a/docs/creating-a-package.md +++ b/docs/creating-a-package.md @@ -210,7 +210,7 @@ specific parts of the interface, like adding a file in the tree-view: '.tree-view': [ {label: 'Add file', command: 'tree-view:add-file'} ] - '.workspace': [ + 'atom-workspace': [ {label: 'Inspect Element', command: 'core:inspect'} ] ``` @@ -233,7 +233,7 @@ an item with a single `type: 'separator'` key/value pair. ```coffeescript 'context-menu': - '.workspace': [ + 'atom-workspace': [ { label: 'Text' submenu: [ diff --git a/keymaps/darwin.cson b/keymaps/darwin.cson index 21bdeeb63..c41757989 100644 --- a/keymaps/darwin.cson +++ b/keymaps/darwin.cson @@ -134,7 +134,7 @@ 'cmd-l': 'editor:select-line' 'ctrl-t': 'editor:transpose' -'.workspace .editor:not(.mini)': +'atom-workspace .editor:not(.mini)': # Atom specific 'alt-cmd-z': 'editor:checkout-head-revision' 'cmd-<': 'editor:scroll-to-cursor' diff --git a/keymaps/linux.cson b/keymaps/linux.cson index 1967a336f..fa08330db 100644 --- a/keymaps/linux.cson +++ b/keymaps/linux.cson @@ -79,7 +79,7 @@ 'alt-8': 'pane:show-item-8' 'alt-9': 'pane:show-item-9' -'.workspace .editor': +'atom-workspace .editor': # Platform Bindings 'ctrl-left': 'editor:move-to-beginning-of-word' 'ctrl-right': 'editor:move-to-end-of-word' @@ -99,7 +99,7 @@ 'ctrl-k ctrl-l': 'editor:lower-case' 'ctrl-l': 'editor:select-line' -'.workspace .editor:not(.mini)': +'atom-workspace .editor:not(.mini)': # Atom specific 'alt-ctrl-z': 'editor:checkout-head-revision' 'ctrl-<': 'editor:scroll-to-cursor' diff --git a/keymaps/win32.cson b/keymaps/win32.cson index d8dbe9f09..6db113735 100644 --- a/keymaps/win32.cson +++ b/keymaps/win32.cson @@ -74,7 +74,7 @@ 'ctrl-k ctrl-left': 'window:focus-pane-on-left' 'ctrl-k ctrl-right': 'window:focus-pane-on-right' -'.workspace .editor': +'atom-workspace .editor': # Platform Bindings 'ctrl-left': 'editor:move-to-beginning-of-word' 'ctrl-right': 'editor:move-to-end-of-word' @@ -94,7 +94,7 @@ 'ctrl-k ctrl-l': 'editor:lower-case' 'ctrl-l': 'editor:select-line' -'.workspace .editor:not(.mini)': +'atom-workspace .editor:not(.mini)': # Atom specific 'alt-ctrl-z': 'editor:checkout-head-revision' 'ctrl-<': 'editor:scroll-to-cursor' diff --git a/spec/fixtures/packages/package-with-activation-commands/index.coffee b/spec/fixtures/packages/package-with-activation-commands/index.coffee index 017058f64..cd9275474 100644 --- a/spec/fixtures/packages/package-with-activation-commands/index.coffee +++ b/spec/fixtures/packages/package-with-activation-commands/index.coffee @@ -6,7 +6,7 @@ module.exports = activate: -> @activateCallCount++ - atom.commands.add '.workspace', 'activation-command', => + atom.commands.add 'atom-workspace', 'activation-command', => @activationCommandCallCount++ atom.workspaceView.getActiveView()?.command 'activation-command', => diff --git a/spec/fixtures/packages/package-with-empty-activation-commands/package.json b/spec/fixtures/packages/package-with-empty-activation-commands/package.json index 1f1a1e343..8b58333ab 100644 --- a/spec/fixtures/packages/package-with-empty-activation-commands/package.json +++ b/spec/fixtures/packages/package-with-empty-activation-commands/package.json @@ -1,5 +1,5 @@ { "name": "no events", "version": "0.1.0", - "activationCommands": {".workspace": []} + "activationCommands": {"atom-workspace": []} } diff --git a/src/context-menu-manager.coffee b/src/context-menu-manager.coffee index baf60f911..19af5938a 100644 --- a/src/context-menu-manager.coffee +++ b/src/context-menu-manager.coffee @@ -42,7 +42,7 @@ class ContextMenuManager # # ```coffee # atom.contextMenu.add { - # '.workspace': [{label: 'Help', command: 'application:open-documentation'}] + # 'atom-workspace': [{label: 'Help', command: 'application:open-documentation'}] # '.editor': [{ # label: 'History', # submenu: [ @@ -161,7 +161,7 @@ class ContextMenuManager clear: -> @activeElement = null @itemSets = [] - @add '.workspace': [{ + @add 'atom-workspace': [{ label: 'Inspect Element' command: 'application:inspect' devMode: true diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index 6ee27d111..39d74dd7b 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -63,14 +63,14 @@ class MenuManager # Selector isn't valid return false - # Simulate an .editor element attached to a .workspace element attached to - # a body element that has the same classes as the current body element. + # Simulate an .editor element attached to a atom-workspace element attached + # to a body element that has the same classes as the current body element. unless @testEditor? testBody = document.createElement('body') testBody.classList.add(@classesForElement(document.body)...) testWorkspace = document.createElement('div') - workspaceClasses = @classesForElement(document.body.querySelector('.workspace')) + workspaceClasses = @classesForElement(document.body.querySelector('atom-workspace')) workspaceClasses = ['workspace'] if workspaceClasses.length is 0 testWorkspace.classList.add(workspaceClasses...) diff --git a/src/package.coffee b/src/package.coffee index 1aec339d7..91ea89175 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -364,15 +364,15 @@ class Package if @metadata.activationEvents? if _.isArray(@metadata.activationEvents) for eventName in @metadata.activationEvents - @activationCommands['.workspace'] ?= [] - @activationCommands['.workspace'].push(eventName) + @activationCommands['atom-workspace'] ?= [] + @activationCommands['atom-workspace'].push(eventName) else if _.isString(@metadata.activationEvents) eventName = @metadata.activationEvents - @activationCommands['.workspace'] ?= [] - @activationCommands['.workspace'].push(eventName) + @activationCommands['atom-workspace'] ?= [] + @activationCommands['atom-workspace'].push(eventName) else for eventName, selector of @metadata.activationEvents - selector ?= '.workspace' + selector ?= 'atom-workspace' @activationCommands[selector] ?= [] @activationCommands[selector].push(eventName) diff --git a/src/window-bootstrap.coffee b/src/window-bootstrap.coffee index 704596915..fa7f9d354 100644 --- a/src/window-bootstrap.coffee +++ b/src/window-bootstrap.coffee @@ -13,5 +13,5 @@ console.log "Window load time: #{atom.getWindowLoadTime()}ms" # Workaround for focus getting cleared upon window creation windowFocused = -> window.removeEventListener('focus', windowFocused) - setTimeout (-> document.querySelector('.workspace').focus()), 0 + setTimeout (-> document.querySelector('atom-workspace').focus()), 0 window.addEventListener('focus', windowFocused) diff --git a/src/workspace-element.coffee b/src/workspace-element.coffee index 8c0cf0f43..b3366225c 100644 --- a/src/workspace-element.coffee +++ b/src/workspace-element.coffee @@ -91,7 +91,7 @@ class WorkspaceElement extends HTMLElement focusPaneViewOnRight: -> @paneContainer.focusPaneViewOnRight() -atom.commands.add '.workspace', +atom.commands.add 'atom-workspace', 'window:increase-font-size': -> @getModel().increaseFontSize() 'window:decrease-font-size': -> @getModel().decreaseFontSize() 'window:reset-font-size': -> @getModel().resetFontSize() @@ -137,8 +137,6 @@ atom.commands.add '.workspace', 'core:save-as': -> @getModel().saveActivePaneItemAs() if process.platform is 'darwin' - atom.commands.add '.workspace', 'window:install-shell-commands', -> @getModel().installShellCommands() + atom.commands.add 'atom-workspace', 'window:install-shell-commands', -> @getModel().installShellCommands() -module.exports = WorkspaceElement = document.registerElement 'atom-workspace', - prototype: WorkspaceElement.prototype - extends: 'div' +module.exports = WorkspaceElement = document.registerElement 'atom-workspace', prototype: WorkspaceElement.prototype diff --git a/static/workspace-view.less b/static/workspace-view.less index d1f88b55a..58c10c2b5 100644 --- a/static/workspace-view.less +++ b/static/workspace-view.less @@ -21,7 +21,7 @@ h6 { font-family: @font-family; } -.workspace { +atom-workspace { height: 100%; overflow: hidden; position: relative;