Use ‘atom-workspace’ custom tag name for WorkspaceElement

This commit is contained in:
Nathan Sobo
2014-10-08 11:47:46 -07:00
parent eedf4894ae
commit 8941b97ed2
12 changed files with 24 additions and 26 deletions

View File

@@ -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: [

View File

@@ -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'

View File

@@ -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'

View File

@@ -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'

View File

@@ -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', =>

View File

@@ -1,5 +1,5 @@
{
"name": "no events",
"version": "0.1.0",
"activationCommands": {".workspace": []}
"activationCommands": {"atom-workspace": []}
}

View File

@@ -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

View File

@@ -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...)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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

View File

@@ -21,7 +21,7 @@ h6 {
font-family: @font-family;
}
.workspace {
atom-workspace {
height: 100%;
overflow: hidden;
position: relative;