Comparar commits

...

97 Commits

Autor SHA1 Mensagem Data
Kevin Sawicki d1e9ad3ed1 ⬆️ apm@0.111.1 2014-12-05 08:44:28 -08:00
Max Brunsfeld d87d98278e ⬆️ status-bar@0.50.0 2014-12-04 14:14:05 -08:00
Kevin Sawicki 682a4be285 ⬆️ language-sass@0.27 2014-12-04 12:47:32 -08:00
Kevin Sawicki 14c68a4280 ⬆️ package-generator@0.33 2014-12-04 12:42:58 -08:00
Ben Ogle ddfbc6c335 Update notifications to add repro steps to issue body 2014-12-04 12:23:22 -08:00
Max Brunsfeld 779642b3da ⬆️ command-palette
For deprecation fixes.

Signed-off-by: Nathan Sobo <nathan@github.com>
2014-12-04 12:13:05 -08:00
Max Brunsfeld 705c78bf18 ⬆️ tabs 2014-12-04 12:09:56 -08:00
Ben Ogle 07a21a15a1 Upgrade find-and-replace to fix tabbing between mini editors 2014-12-04 12:08:49 -08:00
Max Brunsfeld 287895c78c ⬆️ status-bar@0.49.0
For deprecation fixes

Signed-off-by: Nathan Sobo <nathan@github.com>
2014-12-04 12:06:39 -08:00
Kevin Sawicki fcf7b6747b ⬆️ git-diff@0.44 2014-12-04 11:30:47 -08:00
Kevin Sawicki 1af25ea401 ⬆️ exception-reporting@0.21 2014-12-04 11:28:41 -08:00
Max Brunsfeld aecd689593 Call Workspace::getActiveTextEditor, not ::getActiveEditor 2014-12-04 08:57:33 -08:00
Max Brunsfeld 6a83246838 Use native DOM APIs for window drag/drop listeners
Otherwise, these event handlers will interfere with other
event handlers bound using other versions of jQuery
2014-12-03 20:26:36 -08:00
Ben Ogle a7fc1c4138 Upgrade tello@1.0.4 2014-12-03 17:03:00 -08:00
Max Brunsfeld c19aee5472 Carry over remaining tooltip disposal code from space-pen extensions
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Signed-off-by: Nathan Sobo <nathan@github.com>
2014-12-03 17:02:47 -08:00
Ben Ogle e9d49b1df3 📝 Add tooltip examples 2014-12-03 16:23:08 -08:00
Ben Ogle 5a456c8552 📝 Add arg to pane::destroyItem() 2014-12-03 16:11:29 -08:00
Kevin Sawicki 1179ced85c Remove duplicate require 2014-12-03 15:07:07 -08:00
Max Brunsfeld 7738472eb8 ⬆️ timecop@0.24.0
For deprecation fixes
2014-12-03 14:55:19 -08:00
Ben Ogle 45274eaad3 Merge pull request #4390 from atom/bo-panel-for-item
Add Workspace::panelForItem()
2014-12-03 14:15:33 -08:00
Ben Ogle 24f7638e8b Add Workspace::panelForItem() 2014-12-03 12:46:42 -08:00
Ben Ogle 6ec7b7b38d Update notifications to add:
* style tweaks
* remove deprecations
* Only show view issue button when the titles match
2014-12-03 12:20:00 -08:00
Kevin Sawicki 094a7e9a5f ⬆️ go-to-line@0.27 2014-12-03 11:23:16 -08:00
Kevin Sawicki 97181121c9 ⬆️ open-on-github@0.31 2014-12-03 11:12:54 -08:00
Kevin Sawicki 3e4c7a8ab7 ⬆️ link@0.28 2014-12-03 11:07:25 -08:00
Kevin Sawicki f4b08649a0 Use JSON example since package.json is target 2014-12-03 11:04:17 -08:00
Nathan Sobo c1a93395f5 Fix deprecated Workspace::getActiveEditor call 2014-12-03 12:02:47 -07:00
Nathan Sobo 53b538311e Add activationEvents deprecation warning 2014-12-03 12:00:53 -07:00
Kevin Sawicki 19ae78e062 ⬆️ link@0.27 2014-12-03 10:41:01 -08:00
Max Brunsfeld 5a93f14199 ⬇️ wrap-guide@0.24.0
Replacing WorkspaceView::eachEditorView with Workspace::observeTextEditors
doesn't quite work for this use case. Getting this package to work without
deprecated APIs will probably require further changes to core.
2014-12-02 17:05:43 -08:00
Ben Ogle d7dd0f3224 Upgrade solarized dark syntax to 025.0 2014-12-02 16:34:56 -08:00
Ben Ogle 37e6f03346 Fix tooltip command display when command has no keybinding 2014-12-02 16:31:38 -08:00
Ben Ogle 0aa3cd58c1 Upgrade find and replace to the deprecation-free 0.148.0 2014-12-02 15:53:01 -08:00
Ben Ogle ac23717f8c Only beep when there is a workspace
Some specs might not create one.
2014-12-02 15:52:37 -08:00
Nathan Sobo 491561db4a Merge pull request #4380 from atom/ns-upgrade-archive-view
Upgrade archive-view
2014-12-02 16:24:23 -07:00
Max Brunsfeld edfd67b093 ⬆️ welcome@0.21.0
For test-suite speed improvements
2014-12-02 15:15:36 -08:00
Nathan Sobo dd63d47c11 Add getters for decoration types in addition to ‘overlay’ 2014-12-02 15:59:12 -07:00
Nathan Sobo 067f5ea7e8 ⬆️ archive-view 2014-12-02 15:48:56 -07:00
Nathan Sobo eb223c4f21 ⬇️ archive-view until we can get the build passing on CI 2014-12-02 15:33:32 -07:00
Nathan Sobo f632b6fe79 ⬆️ event-kit and text-buffer to try to fix CI 2014-12-02 15:29:55 -07:00
Max Brunsfeld 5bdc8af850 ⬆️ welcome@0.20.0
For deprecation fixes
2014-12-02 13:50:20 -08:00
Nathan Sobo b03931371a ⬆️ bookmarks to remove deprecated API usage 2014-12-02 14:16:30 -07:00
Nathan Sobo c02755f59a ⬆️ archive-view to remove deprecated API usage 2014-12-02 14:04:03 -07:00
Kevin Sawicki e178b25f17 ⬆️ grunt-atom-shell-installer@0.12 2014-12-02 13:00:28 -08:00
Max Brunsfeld 96efb232ee ⬆️ whitespace@0.27.0
For deprecation fixes
2014-12-02 12:51:53 -08:00
Max Brunsfeld 714cbc9f4b Add deprecation warning for Workspace::getActiveEditor 2014-12-02 12:46:05 -08:00
Max Brunsfeld 64e4053a19 Deprecate delegated properties on workspace
* ::activePaneItem was already deprecated, but the stack
  trace was internal and confusing
* ::activePane is newly deprecated
2014-12-02 12:37:27 -08:00
Kevin Sawicki a7f1f90c1d ⬆️ language-javascript@0.47 2014-12-02 11:48:36 -08:00
Kevin Sawicki cacaba936b Add restart helper on Windows 2014-12-02 11:31:18 -08:00
Max Brunsfeld b20589fbb6 Decrease default undo grouping interval to 300ms 2014-12-02 11:19:31 -08:00
Kevin Sawicki d3f14d8939 ⬆️ language-less@0.19 2014-12-02 11:11:40 -08:00
Max Brunsfeld 094ba81758 ⬆️ wrap-guid@0.24.1
For deprecation fixes
2014-12-02 11:06:52 -08:00
Nathan Sobo 8a40be8345 Null guard container in Pane::destroyed 2014-12-02 11:57:38 -07:00
Nathan Sobo 2d8d330df7 Add Workspace::onDidDestroyPaneItem for symmetry with ::onDidDestroyPane 2014-12-02 11:57:38 -07:00
Nathan Sobo fbc9c05096 Add Workspace::onDidDestroyPane
This helps with the background-tips conversion
2014-12-02 11:57:38 -07:00
Nathan Sobo 1eab423a1c Clarify that we’re taking an event in the parameter name 2014-12-02 11:57:38 -07:00
Nathan Sobo cfca6ecc86 Add specs for PaneContainer::onDidAddPane 2014-12-02 11:57:38 -07:00
Kevin Sawicki fb96b01f30 Log from quitAndInstall 2014-12-02 10:42:46 -08:00
Nathan Sobo 625b95a6d9 Test TextEditorElement::setUpdatedSynchronously without waiting
Another attempt to fix flakiness.
2014-12-02 11:37:28 -07:00
Kevin Sawicki 0fe9dc6aa9 Spawn new atom.exe immediately on quitAndInstall 2014-12-02 10:30:58 -08:00
Nathan Sobo 38e6aee46d Un-f 2014-12-02 11:14:59 -07:00
Nathan Sobo 01f87d9678 Null guard workspace element for deprecated update-available dispatch 2014-12-02 11:14:33 -07:00
Nathan Sobo 93bf9357b0 Remove waitsForAnimationFrame spec helper
It doesn’t work reliably on CI.
2014-12-02 11:14:02 -07:00
Kevin Sawicki ed42a275ab 💄 2014-12-02 09:21:56 -08:00
Kevin Sawicki 6998337144 ⬆️ grunt-atom-shell-installer@0.11 2014-12-02 09:16:34 -08:00
Kevin Sawicki 8b92aef3ff Merge pull request #4246 from atom/ks-add-update-menus-on-windows
Add update menus on windows
2014-12-02 09:10:33 -08:00
Kevin Sawicki 66d6af54bf ⬆️ atom-shell@0.19.4 2014-12-02 08:58:00 -08:00
Kevin Sawicki 2a06ece3df ⬆️ atom-shell@0.19.3 2014-12-02 08:58:00 -08:00
Kevin Sawicki 1c0c8db042 Add unsupported state to update manager 2014-12-02 08:58:00 -08:00
Kevin Sawicki 9293ef766b Add update menus on Windows 2014-12-02 08:58:00 -08:00
Max Brunsfeld a7a9b3707f Merge pull request #4365 from atom/ns-view-registry-cleanup
Clean up view registry API
2014-12-02 08:55:00 -08:00
Kevin Sawicki 7e16e42b3f x out flaky spec 2014-12-02 08:39:52 -08:00
Kevin Sawicki 179fb2d274 Start bundling language-clojure
It is now MIT licensed which was the reason it was removed as a
bundled package originally.
2014-12-02 08:21:10 -08:00
Kevin Sawicki f804006d6c ⬆️ language-c@0.32 2014-12-01 17:54:10 -08:00
Nathan Sobo 9a9347e3a5 Simplify ViewRegistry::addViewProvider API
It now takes two arguments, a model constructor and a create view
callback that is passed the model.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-12-01 17:53:03 -08:00
Max Brunsfeld e4bcb96dcc Change ::setModel to ::initialize on all element classes 2014-12-01 17:52:19 -08:00
Kevin Sawicki 8a0992d689 ⬆️ language-gfm@0.55 2014-12-01 17:46:15 -08:00
Kevin Sawicki db17a6cba4 📝 Remove stray to 2014-12-01 17:42:14 -08:00
Kevin Sawicki 5449fc2e15 ⬆️ tree-view@0.135 2014-12-01 17:34:38 -08:00
Kevin Sawicki 0a84ad5307 Use .source.gfm as root selector
This matches the grammar's scope name and was an oversight from the
original CSS to Less conversion.
2014-12-01 17:23:37 -08:00
Max Brunsfeld 485c402661 ⬆️ text-buffer@3.8.1 2014-12-01 16:54:18 -08:00
Nathan Sobo 4591f00a65 Remove view registry references from the workspace model layer
Removed various ::getView methods from the model. Using the atom.views
global in the views for now, but going to switch them over to using a
locally assigned view registry instead in a subsequent commit.
2014-12-01 16:28:33 -08:00
Ben Ogle b635fa0c97 Use Grim.
Refs #3706
2014-12-01 10:58:23 -08:00
Kevin Sawicki 004103d579 ⬆️ bracket-matcher@0.63 2014-12-01 10:23:12 -08:00
Kevin Sawicki 2c952fad95 ⬆️ language-json@0.10 2014-12-01 10:21:24 -08:00
Kevin Sawicki adc983e8da ⬆️ language-java@0.13 2014-12-01 09:46:08 -08:00
Nathan Sobo 7dc9d0c8ce Add Workspace::onWillDestroyPaneItem
It is needed by the autosave package which previously relied on DOM
bubbling to coalesce events from various panes.
2014-12-01 10:39:29 -07:00
Kevin Sawicki 3d3521962c ⬆️ language-ruby@0.44 2014-12-01 09:32:22 -08:00
Kevin Sawicki 46a1f69ab1 ⬆️ language-todo@0.14 2014-12-01 09:24:29 -08:00
Kevin Sawicki 298d3e5fb6 ⬆️ language-objective-c@0.12 2014-12-01 09:14:33 -08:00
Kevin Sawicki 27291980cb ⬆️ language-mustache@0.11 2014-12-01 09:12:14 -08:00
Kevin Sawicki 64ae4bf6c3 ⬆️ language-json@0.9 2014-12-01 09:09:09 -08:00
Kevin Sawicki 90a71d1171 ⬆️ language-ruby@0.43 2014-12-01 08:51:36 -08:00
Kevin Sawicki a5b7d15bcc Remove screen line logging from spec 2014-12-01 08:39:09 -08:00
Kevin Sawicki be2d49a410 Remove unused subscriptions ivar
Closes #4343
2014-12-01 08:37:51 -08:00
Kevin Sawicki 8a9805cc6d ⬆️ language-java@0.12 2014-12-01 08:26:10 -08:00
Kevin Sawicki 196694e352 ⬆️ language-javascript@0.46 2014-12-01 08:20:56 -08:00
48 arquivos alterados com 532 adições e 335 exclusões
+1 -1
Ver Arquivo
@@ -6,6 +6,6 @@
"url": "https://github.com/atom/atom.git"
},
"dependencies": {
"atom-package-manager": "0.111.0"
"atom-package-manager": "0.111.1"
}
}
+2 -2
Ver Arquivo
@@ -12,7 +12,7 @@
"fs-plus": "2.x",
"github-releases": "~0.2.0",
"grunt": "~0.4.1",
"grunt-atom-shell-installer": "^0.10.0",
"grunt-atom-shell-installer": "^0.12.0",
"grunt-cli": "~0.1.9",
"grunt-coffeelint": "git+https://github.com/atom/grunt-coffeelint.git#cfb99aa99811d52687969532bd5a98011ed95bfe",
"grunt-contrib-coffee": "~0.9.0",
@@ -31,7 +31,7 @@
"request": "~2.27.0",
"rimraf": "~2.2.2",
"runas": "~1.0.1",
"tello": "1.0.3",
"tello": "1.0.4",
"temp": "~0.8.1",
"underscore-plus": "1.x",
"unzip": "~0.1.9",
+1 -1
Ver Arquivo
@@ -72,7 +72,7 @@ Writing Asynchronous specs can be tricky at first. Some examples.
atom.workspace.open 'c.coffee'
it "should be opened in an editor", ->
expect(atom.workspace.getActiveEditor().getPath()).toContain 'c.coffee'
expect(atom.workspace.getActiveTextEditor().getPath()).toContain 'c.coffee'
```
+3
Ver Arquivo
@@ -164,6 +164,9 @@
{ label: 'View &Terms of Use', command: 'application:open-terms-of-use' }
{ label: 'View &License', command: 'application:open-license' }
{ label: 'VERSION', enabled: false }
{ label: 'Restart and Install Update', command: 'application:install-update', visible: false}
{ label: 'Check for Update', command: 'application:check-for-update', visible: false}
{ label: 'Downloading Update', enabled: false, visible: false}
{ type: 'separator' }
{ label: '&Documentation', command: 'application:open-documentation' }
{ label: 'Roadmap', command: 'application:open-roadmap' }
+33 -32
Ver Arquivo
@@ -27,7 +27,7 @@
"coffeestack": "0.7.0",
"delegato": "^1",
"emissary": "^1.3.1",
"event-kit": "0.7.2",
"event-kit": "0.8.1",
"first-mate": "^2.2.0",
"fs-plus": "^2.3.2",
"fstream": "0.1.24",
@@ -60,7 +60,7 @@
"serializable": "^1",
"space-pen": "3.8.2",
"temp": "0.7.0",
"text-buffer": "^3.8.0",
"text-buffer": "^3.8.2",
"theorist": "^1.0.2",
"underscore-plus": "^1.6.1",
"vm-compatibility-layer": "0.1.0"
@@ -72,75 +72,76 @@
"atom-light-ui": "0.36.0",
"base16-tomorrow-dark-theme": "0.22.0",
"base16-tomorrow-light-theme": "0.5.0",
"solarized-dark-syntax": "0.24.0",
"solarized-dark-syntax": "0.25.0",
"solarized-light-syntax": "0.13.0",
"archive-view": "0.37.0",
"archive-view": "0.40.0",
"autocomplete": "0.33.1",
"autoflow": "0.18.0",
"autosave": "0.18.0",
"background-tips": "0.17.0",
"bookmarks": "0.30.0",
"bracket-matcher": "0.62.0",
"command-palette": "0.29.0",
"bookmarks": "0.31.0",
"bracket-matcher": "0.63.0",
"command-palette": "0.30.0",
"deprecation-cop": "0.18.0",
"dev-live-reload": "0.35.0",
"encoding-selector": "0.8.0",
"exception-reporting": "0.20.0",
"find-and-replace": "0.147.0",
"exception-reporting": "0.21.0",
"find-and-replace": "0.149.0",
"fuzzy-finder": "0.60.0",
"git-diff": "0.43.0",
"go-to-line": "0.26.0",
"git-diff": "0.44.0",
"go-to-line": "0.27.0",
"grammar-selector": "0.37.0",
"image-view": "0.42.0",
"incompatible-packages": "0.10.0",
"keybinding-resolver": "0.20.0",
"link": "0.26.0",
"link": "0.28.0",
"markdown-preview": "0.110.0",
"metrics": "0.39.0",
"notifications": "0.4.0",
"open-on-github": "0.30.0",
"package-generator": "0.32.0",
"notifications": "0.6.0",
"open-on-github": "0.31.0",
"package-generator": "0.33.0",
"release-notes": "0.36.0",
"settings-view": "0.161.0",
"snippets": "0.57.0",
"spell-check": "0.44.0",
"status-bar": "0.48.0",
"status-bar": "0.50.0",
"styleguide": "0.30.0",
"symbols-view": "0.68.0",
"tabs": "0.56.0",
"timecop": "0.23.0",
"tree-view": "0.134.0",
"tabs": "0.57.0",
"timecop": "0.24.0",
"tree-view": "0.135.0",
"update-package-dependencies": "0.6.0",
"welcome": "0.19.0",
"whitespace": "0.26.0",
"welcome": "0.21.0",
"whitespace": "0.27.0",
"wrap-guide": "0.24.0",
"language-c": "0.31.0",
"language-c": "0.32.0",
"language-clojure": "0.9.0",
"language-coffee-script": "0.38.1",
"language-css": "0.23.1",
"language-gfm": "0.54.1",
"language-gfm": "0.55.0",
"language-git": "0.9.0",
"language-go": "0.19.1",
"language-html": "0.26.1",
"language-hyperlink": "0.12.2",
"language-java": "0.11.0",
"language-javascript": "0.45.1",
"language-json": "0.8.0",
"language-less": "0.18.1",
"language-java": "0.13.0",
"language-javascript": "0.47.0",
"language-json": "0.10.0",
"language-less": "0.19.0",
"language-make": "0.12.0",
"language-mustache": "0.10.1",
"language-objective-c": "0.11.0",
"language-mustache": "0.11.0",
"language-objective-c": "0.12.0",
"language-perl": "0.9.0",
"language-php": "0.18.0",
"language-property-list": "0.7.0",
"language-python": "0.24.1",
"language-ruby": "0.42.0",
"language-ruby": "0.44.0",
"language-ruby-on-rails": "0.18.0",
"language-sass": "0.26.1",
"language-sass": "0.27.0",
"language-shellscript": "0.10.1",
"language-source": "0.8.0",
"language-sql": "0.11.0",
"language-text": "0.6.0",
"language-todo": "0.13.0",
"language-todo": "0.14.0",
"language-toml": "0.14.1",
"language-xml": "0.25.0",
"language-yaml": "0.20.1"
@@ -9,6 +9,6 @@ module.exports =
atom.commands.add 'atom-workspace', 'activation-command', =>
@activationCommandCallCount++
editorView = atom.views.getView(atom.workspace.getActiveEditor())?.__spacePenView
editorView = atom.views.getView(atom.workspace.getActiveTextEditor())?.__spacePenView
editorView?.command 'activation-command', =>
@legacyActivationCommandCallCount++
+1 -1
Ver Arquivo
@@ -132,7 +132,7 @@ describe "GitRepository", ->
atom.workspace.open(filePath)
runs ->
editor = atom.workspace.getActiveEditor()
editor = atom.workspace.getActiveTextEditor()
it "displays a confirmation dialog by default", ->
spyOn(atom, 'confirm').andCallFake ({buttons}) -> buttons.OK()
+1 -1
Ver Arquivo
@@ -144,7 +144,7 @@ describe "PackageManager", ->
atom.workspace.open()
runs ->
editorView = atom.views.getView(atom.workspace.getActiveEditor()).__spacePenView
editorView = atom.views.getView(atom.workspace.getActiveTextEditor()).__spacePenView
legacyCommandListener = jasmine.createSpy("legacyCommandListener")
editorView.command 'activation-command', legacyCommandListener
editorCommandListener = jasmine.createSpy("editorCommandListener")
+54
Ver Arquivo
@@ -148,3 +148,57 @@ describe "PaneContainer", ->
saved = container.confirmClose()
expect(saved).toBeFalsy()
expect(atom.confirm).toHaveBeenCalled()
describe "::onDidAddPane(callback)", ->
it "invokes the given callback when panes are added", ->
container = new PaneContainer
events = []
container.onDidAddPane (event) -> events.push(event)
pane1 = container.getActivePane()
pane2 = pane1.splitRight()
pane3 = pane2.splitDown()
expect(events).toEqual [{pane: pane2}, {pane: pane3}]
describe "::onDidDestroyPane(callback)", ->
it "invokes the given callback when panes are destroyed", ->
container = new PaneContainer
events = []
container.onDidDestroyPane (event) -> events.push(event)
pane1 = container.getActivePane()
pane2 = pane1.splitRight()
pane3 = pane2.splitDown()
pane2.destroy()
pane3.destroy()
expect(events).toEqual [{pane: pane2}, {pane: pane3}]
describe "::onWillDestroyPaneItem() and ::onDidDestroyPaneItem", ->
it "invokes the given callbacks when an item will be destroyed on any pane", ->
container = new PaneContainer
pane1 = container.getRoot()
item1 = new Object
item2 = new Object
item3 = new Object
pane1.addItem(item1)
events = []
container.onWillDestroyPaneItem (event) -> events.push(['will', event])
container.onDidDestroyPaneItem (event) -> events.push(['did', event])
pane2 = pane1.splitRight(items: [item2, item3])
pane1.destroyItem(item1)
pane2.destroyItem(item3)
pane2.destroyItem(item2)
expect(events).toEqual [
['will', {item: item1, pane: pane1, index: 0}]
['did', {item: item1, pane: pane1, index: 0}]
['will', {item: item3, pane: pane2, index: 1}]
['did', {item: item3, pane: pane2, index: 1}]
['will', {item: item2, pane: pane2, index: 0}]
['did', {item: item2, pane: pane2, index: 0}]
]
+4 -4
Ver Arquivo
@@ -229,7 +229,7 @@ describe "PaneView", ->
beforeEach ->
pane2Model = paneModel.splitRight() # Can't destroy the last pane, so we add another
pane2 = containerModel.getView(pane2Model).__spacePenView
pane2 = atom.views.getView(pane2Model).__spacePenView
it "triggers a 'pane:removed' event with the pane", ->
removedHandler = jasmine.createSpy("removedHandler")
@@ -262,7 +262,7 @@ describe "PaneView", ->
beforeEach ->
pane2Model = paneModel.splitRight(items: [pane.copyActiveItem()])
pane2 = containerModel.getView(pane2Model).__spacePenView
pane2 = atom.views.getView(pane2Model).__spacePenView
expect(pane2Model.isActive()).toBe true
it "adds or removes the .active class as appropriate", ->
@@ -309,8 +309,8 @@ describe "PaneView", ->
pane2Model = pane1Model.splitRight(items: [pane1Model.copyActiveItem()])
pane3Model = pane2Model.splitDown(items: [pane2Model.copyActiveItem()])
pane2 = pane2Model._view
pane2 = containerModel.getView(pane2Model).__spacePenView
pane3 = containerModel.getView(pane3Model).__spacePenView
pane2 = atom.views.getView(pane2Model).__spacePenView
pane3 = atom.views.getView(pane3Model).__spacePenView
expect(container.find('> atom-pane-axis.horizontal > atom-pane').toArray()).toEqual [pane1[0]]
expect(container.find('> atom-pane-axis.horizontal > atom-pane-axis.vertical > atom-pane').toArray()).toEqual [pane2[0], pane3[0]]
+39 -42
Ver Arquivo
@@ -1,11 +1,10 @@
ViewRegistry = require '../src/view-registry'
Panel = require '../src/panel'
PanelElement = require '../src/panel-element'
PanelContainer = require '../src/panel-container'
PanelContainerElement = require '../src/panel-container-element'
describe "PanelContainerElement", ->
[jasmineContent, element, container, viewRegistry] = []
[jasmineContent, element, container] = []
class TestPanelContainerItem
constructior: ->
@@ -13,25 +12,23 @@ describe "PanelContainerElement", ->
class TestPanelContainerItemElement extends HTMLElement
createdCallback: ->
@classList.add('test-root')
setModel: (@model) ->
initialize: (@model) ->
this
TestPanelContainerItemElement = document.registerElement 'atom-test-container-item-element', prototype: TestPanelContainerItemElement.prototype
beforeEach ->
jasmineContent = document.body.querySelector('#jasmine-content')
viewRegistry = new ViewRegistry
viewRegistry.addViewProvider
modelConstructor: Panel
viewConstructor: PanelElement
viewRegistry.addViewProvider
modelConstructor: PanelContainer
viewConstructor: PanelContainerElement
viewRegistry.addViewProvider
modelConstructor: TestPanelContainerItem
viewConstructor: TestPanelContainerItemElement
atom.views.addViewProvider Panel, (model) ->
new PanelElement().initialize(model)
atom.views.addViewProvider PanelContainer, (model) ->
new PaneContainerElement().initialize(model)
atom.views.addViewProvider TestPanelContainerItem, (model) ->
new TestPanelContainerItemElement().initialize(model)
container = new PanelContainer({viewRegistry, location: 'left'})
element = container.getView()
container = new PanelContainer({location: 'left'})
element = atom.views.getView(container)
jasmineContent.appendChild(element)
it 'has a location class with value from the model', ->
@@ -44,9 +41,9 @@ describe "PanelContainerElement", ->
describe "adding and removing panels", ->
it "allows panels to be inserted at any position", ->
panel1 = new Panel({viewRegistry, item: new TestPanelContainerItem(), priority: 10})
panel2 = new Panel({viewRegistry, item: new TestPanelContainerItem(), priority: 5})
panel3 = new Panel({viewRegistry, item: new TestPanelContainerItem(), priority: 8})
panel1 = new Panel({item: new TestPanelContainerItem(), priority: 10})
panel2 = new Panel({item: new TestPanelContainerItem(), priority: 5})
panel3 = new Panel({item: new TestPanelContainerItem(), priority: 8})
container.addPanel(panel1)
container.addPanel(panel2)
@@ -60,7 +57,7 @@ describe "PanelContainerElement", ->
it "adds atom-panel elements when a new panel is added to the container; removes them when the panels are destroyed", ->
expect(element.childNodes.length).toBe 0
panel1 = new Panel({viewRegistry, item: new TestPanelContainerItem()})
panel1 = new Panel({item: new TestPanelContainerItem()})
container.addPanel(panel1)
expect(element.childNodes.length).toBe 1
expect(element.childNodes[0]).toHaveClass 'left'
@@ -69,12 +66,12 @@ describe "PanelContainerElement", ->
expect(element.childNodes[0].tagName).toBe 'ATOM-PANEL'
panel2 = new Panel({viewRegistry, item: new TestPanelContainerItem()})
panel2 = new Panel({item: new TestPanelContainerItem()})
container.addPanel(panel2)
expect(element.childNodes.length).toBe 2
expect(panel1.getView().style.display).not.toBe 'none'
expect(panel2.getView().style.display).not.toBe 'none'
expect(atom.views.getView(panel1).style.display).not.toBe 'none'
expect(atom.views.getView(panel2).style.display).not.toBe 'none'
panel1.destroy()
expect(element.childNodes.length).toBe 1
@@ -84,26 +81,26 @@ describe "PanelContainerElement", ->
describe "when the container is at the bottom location", ->
beforeEach ->
container = new PanelContainer({viewRegistry, location: 'bottom'})
element = container.getView()
container = new PanelContainer({location: 'bottom'})
element = atom.views.getView(container)
jasmineContent.appendChild(element)
it "adds atom-panel elements when a new panel is added to the container; removes them when the panels are destroyed", ->
expect(element.childNodes.length).toBe 0
panel1 = new Panel({viewRegistry, item: new TestPanelContainerItem(), className: 'one'})
panel1 = new Panel({item: new TestPanelContainerItem(), className: 'one'})
container.addPanel(panel1)
expect(element.childNodes.length).toBe 1
expect(element.childNodes[0]).toHaveClass 'bottom'
expect(element.childNodes[0]).toHaveClass 'tool-panel' # legacy selector support
expect(element.childNodes[0]).toHaveClass 'panel-bottom' # legacy selector support
expect(element.childNodes[0].tagName).toBe 'ATOM-PANEL'
expect(panel1.getView()).toHaveClass 'one'
expect(atom.views.getView(panel1)).toHaveClass 'one'
panel2 = new Panel({viewRegistry, item: new TestPanelContainerItem(), className: 'two'})
panel2 = new Panel({item: new TestPanelContainerItem(), className: 'two'})
container.addPanel(panel2)
expect(element.childNodes.length).toBe 2
expect(panel2.getView()).toHaveClass 'two'
expect(atom.views.getView(panel2)).toHaveClass 'two'
panel1.destroy()
expect(element.childNodes.length).toBe 1
@@ -113,34 +110,34 @@ describe "PanelContainerElement", ->
describe "when the container is modal", ->
beforeEach ->
container = new PanelContainer({viewRegistry, location: 'modal'})
element = container.getView()
container = new PanelContainer({location: 'modal'})
element = atom.views.getView(container)
jasmineContent.appendChild(element)
it "allows only one panel to be visible at a time", ->
panel1 = new Panel({viewRegistry, item: new TestPanelContainerItem()})
panel1 = new Panel({item: new TestPanelContainerItem()})
container.addPanel(panel1)
expect(panel1.getView().style.display).not.toBe 'none'
expect(atom.views.getView(panel1).style.display).not.toBe 'none'
panel2 = new Panel({viewRegistry, item: new TestPanelContainerItem()})
panel2 = new Panel({item: new TestPanelContainerItem()})
container.addPanel(panel2)
expect(panel1.getView().style.display).toBe 'none'
expect(panel2.getView().style.display).not.toBe 'none'
expect(atom.views.getView(panel1).style.display).toBe 'none'
expect(atom.views.getView(panel2).style.display).not.toBe 'none'
panel1.show()
expect(panel1.getView().style.display).not.toBe 'none'
expect(panel2.getView().style.display).toBe 'none'
expect(atom.views.getView(panel1).style.display).not.toBe 'none'
expect(atom.views.getView(panel2).style.display).toBe 'none'
it "adds the 'modal' class to panels", ->
panel1 = new Panel({viewRegistry, item: new TestPanelContainerItem()})
panel1 = new Panel({item: new TestPanelContainerItem()})
container.addPanel(panel1)
expect(panel1.getView()).toHaveClass 'modal'
expect(atom.views.getView(panel1)).toHaveClass 'modal'
# legacy selector support
expect(panel1.getView()).not.toHaveClass 'tool-panel'
expect(panel1.getView()).toHaveClass 'overlay'
expect(panel1.getView()).toHaveClass 'from-top'
expect(atom.views.getView(panel1)).not.toHaveClass 'tool-panel'
expect(atom.views.getView(panel1)).toHaveClass 'overlay'
expect(atom.views.getView(panel1)).toHaveClass 'from-top'
+4 -6
Ver Arquivo
@@ -1,16 +1,14 @@
ViewRegistry = require '../src/view-registry'
Panel = require '../src/panel'
PanelContainer = require '../src/panel-container'
describe "PanelContainer", ->
[container, viewRegistry] = []
[container] = []
class TestPanelItem
constructior: ->
beforeEach ->
viewRegistry = new ViewRegistry
container = new PanelContainer({viewRegistry})
container = new PanelContainer
describe "::addPanel(panel)", ->
it 'emits an onDidAddPanel event with the index the panel was inserted at', ->
@@ -46,7 +44,7 @@ describe "PanelContainer", ->
[initialPanel] = []
beforeEach ->
# 'left' logic is the same as 'top'
container = new PanelContainer({viewRegistry, location: 'left'})
container = new PanelContainer({location: 'left'})
initialPanel = new Panel(item: new TestPanelItem())
container.addPanel(initialPanel)
@@ -75,7 +73,7 @@ describe "PanelContainer", ->
[initialPanel] = []
beforeEach ->
# 'bottom' logic is the same as 'right'
container = new PanelContainer({viewRegistry, location: 'right'})
container = new PanelContainer({location: 'right'})
initialPanel = new Panel(item: new TestPanelItem())
container.addPanel(initialPanel)
+16 -18
Ver Arquivo
@@ -1,9 +1,8 @@
ViewRegistry = require '../src/view-registry'
Panel = require '../src/panel'
PanelElement = require '../src/panel-element'
describe "PanelElement", ->
[jasmineContent, element, panel, viewRegistry] = []
[jasmineContent, element, panel] = []
class TestPanelItem
constructior: ->
@@ -11,23 +10,22 @@ describe "PanelElement", ->
class TestPanelItemElement extends HTMLElement
createdCallback: ->
@classList.add('test-root')
setModel: (@model) ->
initialize: (@model) ->
this
TestPanelItemElement = document.registerElement 'atom-test-item-element', prototype: TestPanelItemElement.prototype
beforeEach ->
jasmineContent = document.body.querySelector('#jasmine-content')
viewRegistry = new ViewRegistry
viewRegistry.addViewProvider
modelConstructor: Panel
viewConstructor: PanelElement
viewRegistry.addViewProvider
modelConstructor: TestPanelItem
viewConstructor: TestPanelItemElement
atom.views.addViewProvider Panel, (model) ->
new PanelElement().initialize(model)
atom.views.addViewProvider TestPanelItem, (model) ->
new TestPanelItemElement().initialize(model)
it 'removes the element when the panel is destroyed', ->
panel = new Panel({viewRegistry, item: new TestPanelItem})
element = panel.getView()
panel = new Panel({item: new TestPanelItem})
element = atom.views.getView(panel)
jasmineContent.appendChild(element)
expect(element.parentNode).toBe jasmineContent
@@ -36,15 +34,15 @@ describe "PanelElement", ->
describe "changing panel visibility", ->
it 'initially renders panel created with visibile: false', ->
panel = new Panel({viewRegistry, visible: false, item: new TestPanelItem})
element = panel.getView()
panel = new Panel({visible: false, item: new TestPanelItem})
element = atom.views.getView(panel)
jasmineContent.appendChild(element)
expect(element.style.display).toBe 'none'
it 'hides and shows the panel element when Panel::hide() and Panel::show() are called', ->
panel = new Panel({viewRegistry, item: new TestPanelItem})
element = panel.getView()
panel = new Panel({item: new TestPanelItem})
element = atom.views.getView(panel)
jasmineContent.appendChild(element)
expect(element.style.display).not.toBe 'none'
@@ -57,8 +55,8 @@ describe "PanelElement", ->
describe "when a class name is specified", ->
it 'initially renders panel created with visibile: false', ->
panel = new Panel({viewRegistry, className: 'some classes', item: new TestPanelItem})
element = panel.getView()
panel = new Panel({className: 'some classes', item: new TestPanelItem})
element = atom.views.getView(panel)
jasmineContent.appendChild(element)
expect(element).toHaveClass 'some'
-3
Ver Arquivo
@@ -304,9 +304,6 @@ window.waitsForPromise = (args...) ->
jasmine.getEnv().currentSpec.fail("Expected promise to be resolved, but it was rejected with #{jasmine.pp(error)}")
moveOn()
window.waitsForAnimationFrame = ->
waitsFor "next animation frame", (done) -> requestAnimationFrame(done)
window.resetTimeouts = ->
window.now = 0
window.timeoutCount = 0
+9 -8
Ver Arquivo
@@ -101,6 +101,8 @@ describe "TextEditorElement", ->
describe "::setUpdatedSynchronously", ->
it "controls whether the text editor is updated synchronously", ->
spyOn(window, 'requestAnimationFrame').andCallFake (fn) -> fn()
element = new TextEditorElement
jasmine.attachToDOM(element)
@@ -108,13 +110,12 @@ describe "TextEditorElement", ->
expect(element.isUpdatedSynchronously()).toBe false
element.getModel().setText("hello")
expect(element.shadowRoot.textContent).not.toContain "hello"
expect(window.requestAnimationFrame).toHaveBeenCalled()
waitsForAnimationFrame()
expect(element.shadowRoot.textContent).toContain "hello"
runs ->
expect(element.shadowRoot.textContent).toContain "hello"
element.setUpdatedSynchronously(true)
element.getModel().setText("goodbye")
expect(element.shadowRoot.textContent).toContain "goodbye"
window.requestAnimationFrame.reset()
element.setUpdatedSynchronously(true)
element.getModel().setText("goodbye")
expect(window.requestAnimationFrame).not.toHaveBeenCalled()
expect(element.shadowRoot.textContent).toContain "goodbye"
-1
Ver Arquivo
@@ -3398,7 +3398,6 @@ describe "TextEditor", ->
expect(editor.getCursorBufferPosition()).toEqual([7, 2])
editor.insertNewline()
editor.logScreenLines()
expect(editor.lineTextForBufferRow(8)).toBe(" ")
it "does not indent the line preceding the newline", ->
+7
Ver Arquivo
@@ -59,6 +59,13 @@ describe "TooltipManager", ->
tooltipElement = document.body.querySelector(".tooltip")
expect(tooltipElement).toHaveText "⌃X ⌃Y"
it "does not display the keybinding if there is nothing mapped to the specified keyBindingCommand", ->
manager.add element, title: 'A Title', keyBindingCommand: 'test-command', keyBindingTarget: element
hover element, ->
tooltipElement = document.body.querySelector(".tooltip")
expect(tooltipElement.textContent).toBe "A Title"
describe "when .dispose() is called on the returned disposable", ->
it "no longer displays the tooltip on hover", ->
disposable = manager.add element, title: "Title"
+19 -39
Ver Arquivo
@@ -25,47 +25,27 @@ describe "ViewRegistry", ->
describe "when passed a model object", ->
describe "when a view provider is registered matching the object's constructor", ->
describe "when the provider has a viewConstructor property", ->
it "constructs a view element and assigns the model on it", ->
class TestModel
it "constructs a view element and assigns the model on it", ->
class TestModel
class TestModelSubclass extends TestModel
class TestModelSubclass extends TestModel
class TestView
setModel: (@model) ->
class TestView
initialize: (@model) -> this
model = new TestModel
model = new TestModel
registry.addViewProvider
modelConstructor: TestModel
viewConstructor: TestView
registry.addViewProvider TestModel, (model) ->
new TestView().initialize(model)
view = registry.getView(model)
expect(view instanceof TestView).toBe true
expect(view.model).toBe model
view = registry.getView(model)
expect(view instanceof TestView).toBe true
expect(view.model).toBe model
subclassModel = new TestModelSubclass
view2 = registry.getView(subclassModel)
expect(view2 instanceof TestView).toBe true
expect(view2.model).toBe subclassModel
describe "when the provider has a createView method", ->
it "constructs a view element by calling the createView method with the model", ->
class TestModel
class TestView
setModel: (@model) ->
registry.addViewProvider
modelConstructor: TestModel
createView: (model) ->
view = new TestView
view.setModel(model)
view
model = new TestModel
view = registry.getView(model)
expect(view instanceof TestView).toBe true
expect(view.model).toBe model
subclassModel = new TestModelSubclass
view2 = registry.getView(subclassModel)
expect(view2 instanceof TestView).toBe true
expect(view2.model).toBe subclassModel
describe "when no view provider is registered for the object's constructor", ->
describe "when the object has a .getViewClass() method", ->
@@ -97,10 +77,10 @@ describe "ViewRegistry", ->
it "returns a disposable that can be used to remove the provider", ->
class TestModel
class TestView
setModel: (@model) ->
disposable = registry.addViewProvider
modelConstructor: TestModel
viewConstructor: TestView
initialize: (@model) -> this
disposable = registry.addViewProvider TestModel, (model) ->
new TestView().initialize(model)
expect(registry.getView(new TestModel) instanceof TestView).toBe true
disposable.dispose()
+4 -6
Ver Arquivo
@@ -128,17 +128,15 @@ describe "Window", ->
setData: (key, value) -> @data[key] = value
getData: (key) -> @data[key]
event = $.Event(type)
event.originalEvent = { dataTransfer }
event.preventDefault = ->
event.stopPropagation = ->
event = new CustomEvent("drop")
event.dataTransfer = dataTransfer
event
describe "when a file is dragged to window", ->
it "opens it", ->
spyOn(atom, "open")
event = buildDragEvent("drop", [ {path: "/fake1"}, {path: "/fake2"} ])
$(document).trigger(event)
document.dispatchEvent(event)
expect(atom.open.callCount).toBe 1
expect(atom.open.argsForCall[0][0]).toEqual pathsToOpen: ['/fake1', '/fake2']
@@ -146,7 +144,7 @@ describe "Window", ->
it "does nothing", ->
spyOn(atom, "open")
event = buildDragEvent("drop", [])
$(document).trigger(event)
document.dispatchEvent(event)
expect(atom.open).not.toHaveBeenCalled()
describe "when a link is clicked", ->
+19 -11
Ver Arquivo
@@ -356,7 +356,7 @@ describe "Workspace", ->
atom.workspace.open('sample.coffee')
runs ->
atom.workspace.getActiveEditor().setText """
atom.workspace.getActiveTextEditor().setText """
i = /test/; #FIXME
"""
@@ -462,14 +462,12 @@ describe "Workspace", ->
class TestItemElement extends HTMLElement
constructor: ->
setModel: (@model) ->
initialize: (@model) -> this
getModel: -> @model
beforeEach ->
atom.views.addViewProvider(
modelConstructor: TestItem
viewConstructor: TestItemElement
)
atom.views.addViewProvider TestItem, (model) ->
new TestItemElement().initialize(model)
describe '::addLeftPanel(model)', ->
it 'adds a panel to the correct panel container', ->
@@ -482,7 +480,7 @@ describe "Workspace", ->
expect(panel).toBeDefined()
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
itemView = atom.workspace.getLeftPanels()[0].getItemView()
itemView = atom.views.getView(atom.workspace.getLeftPanels()[0].getItem())
expect(itemView instanceof TestItemElement).toBe(true)
expect(itemView.getModel()).toBe(model)
@@ -497,7 +495,7 @@ describe "Workspace", ->
expect(panel).toBeDefined()
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
itemView = atom.workspace.getRightPanels()[0].getItemView()
itemView = atom.views.getView(atom.workspace.getRightPanels()[0].getItem())
expect(itemView instanceof TestItemElement).toBe(true)
expect(itemView.getModel()).toBe(model)
@@ -512,7 +510,7 @@ describe "Workspace", ->
expect(panel).toBeDefined()
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
itemView = atom.workspace.getTopPanels()[0].getItemView()
itemView = atom.views.getView(atom.workspace.getTopPanels()[0].getItem())
expect(itemView instanceof TestItemElement).toBe(true)
expect(itemView.getModel()).toBe(model)
@@ -527,7 +525,7 @@ describe "Workspace", ->
expect(panel).toBeDefined()
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
itemView = atom.workspace.getBottomPanels()[0].getItemView()
itemView = atom.views.getView(atom.workspace.getBottomPanels()[0].getItem())
expect(itemView instanceof TestItemElement).toBe(true)
expect(itemView.getModel()).toBe(model)
@@ -542,6 +540,16 @@ describe "Workspace", ->
expect(panel).toBeDefined()
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
itemView = atom.workspace.getModalPanels()[0].getItemView()
itemView = atom.views.getView(atom.workspace.getModalPanels()[0].getItem())
expect(itemView instanceof TestItemElement).toBe(true)
expect(itemView.getModel()).toBe(model)
describe "::panelForItem(item)", ->
it "returns the panel associated with the item", ->
item = new TestItem
panel = atom.workspace.addLeftPanel(item: item)
itemWithNoPanel = new TestItem
expect(atom.workspace.panelForItem(item)).toBe panel
expect(atom.workspace.panelForItem(itemWithNoPanel)).toBe null
+1 -2
Ver Arquivo
@@ -5,7 +5,6 @@ path = require 'path'
remote = require 'remote'
screen = require 'screen'
shell = require 'shell'
{deprecate} = require 'grim'
_ = require 'underscore-plus'
{deprecate} = require 'grim'
@@ -604,7 +603,7 @@ class Atom extends Model
# Essential: Visually and audibly trigger a beep.
beep: ->
shell.beep() if @config.get('core.audioBeep')
@__workspaceView.trigger 'beep'
@__workspaceView?.trigger 'beep'
@emitter.emit 'did-beep'
# Essential: A flexible way to open a dialog akin to an alert dialog.
+7
Ver Arquivo
@@ -7,6 +7,7 @@ CheckingState = 'checking'
DownladingState = 'downloading'
UpdateAvailableState = 'update-available'
NoUpdateAvailableState = 'no-update-available'
UnsupportedState = 'unsupported'
ErrorState = 'error'
module.exports =
@@ -53,6 +54,12 @@ class AutoUpdateManager
unless /\w{7}/.test(@version)
@check(hidePopups: true)
switch process.platform
when 'win32'
@setState(UnsupportedState) unless autoUpdater.supportsUpdates()
when 'linux'
@setState(UnsupportedState)
emitUpdateAvailableEvent: (windows...) ->
return unless @releaseVersion? and @releaseNotes
for atomWindow in windows
+8 -9
Ver Arquivo
@@ -1,6 +1,5 @@
{EventEmitter} = require 'events'
_ = require 'underscore-plus'
shellAutoUpdater = require 'auto-updater'
SquirrelUpdate = require './squirrel-update'
class AutoUpdater
@@ -9,15 +8,12 @@ class AutoUpdater
setFeedUrl: (@updateUrl) ->
quitAndInstall: ->
unless SquirrelUpdate.existsSync()
shellAutoUpdater.quitAndInstall()
return
console.log 'restarting new atom.exe'
@installUpdate (error) ->
return if error?
SquirrelUpdate.spawn ['--processStart', 'atom.exe'], ->
shellAutoUpdater.quitAndInstall()
if SquirrelUpdate.existsSync()
SquirrelUpdate.restartAtom()
else
require('auto-updater').quitAndInstall()
downloadUpdate: (callback) ->
SquirrelUpdate.spawn ['--download', @updateUrl], (error, stdout) ->
@@ -36,6 +32,9 @@ class AutoUpdater
installUpdate: (callback) ->
SquirrelUpdate.spawn(['--update', @updateUrl], callback)
supportsUpdates: ->
SquirrelUpdate.existsSync()
checkForUpdates: ->
throw new Error('Update URL is not set') unless @updateUrl
+6 -2
Ver Arquivo
@@ -36,7 +36,7 @@ spawn = (command, args, callback) ->
error ?= new Error("Command failed: #{signal ? code}") if code isnt 0
error?.code ?= code
error?.stdout ?= stdout
callback(error, stdout)
callback?(error, stdout)
# Spawn reg.exe and callback when it completes
spawnReg = (args, callback) ->
@@ -159,7 +159,6 @@ removeCommandsFromPath = (callback) ->
else
callback()
# Create a desktop and start menu shortcut by using the command line API
# provided by Squirrel's Update.exe
createShortcut = (callback) ->
@@ -176,6 +175,11 @@ exports.spawn = spawnUpdate
exports.existsSync = ->
fs.existsSync(updateDotExe)
# Restart Atom using the version pointed to by the atom.cmd shim
exports.restartAtom = ->
app.once 'will-quit', -> spawn(path.join(binFolder, 'atom.cmd'))
app.quit()
# Handle squirrel events denoted by --squirrel-* command line arguments.
exports.handleStartupEvent = ->
switch process.argv[1]
+1 -1
Ver Arquivo
@@ -149,7 +149,7 @@ module.exports =
default: false
undoGroupingInterval:
type: 'integer'
default: 500
default: 300
minimum: 0
description: 'Time interval in milliseconds within which operations will be grouped together in the undo history'
useHardwareAcceleration:
+1 -1
Ver Arquivo
@@ -476,7 +476,7 @@ class Cursor extends Model
endOfWordPosition or currentBufferPosition
getMoveNextWordBoundaryBufferPosition: (options) ->
deprecate 'Use `::getNextWordBoundaryBufferPosition(options)` instead'
Grim.deprecate 'Use `::getNextWordBoundaryBufferPosition(options)` instead'
@getNextWordBoundaryBufferPosition(options)
# Public: Retrieves the buffer position of where the current word starts.
+9
Ver Arquivo
@@ -889,6 +889,15 @@ class DisplayBuffer extends Model
allDecorations = allDecorations.concat(decorations) if decorations?
allDecorations
getLineDecorations: ->
@getDecorations().filter (decoration) -> decoration.isType('line')
getGutterDecorations: ->
@getDecorations().filter (decoration) -> decoration.isType('gutter')
getHighlightDecorations: ->
@getDecorations().filter (decoration) -> decoration.isType('highlight')
getOverlayDecorations: ->
@getDecorations().filter (decoration) -> decoration.isType('overlay')
+10
Ver Arquivo
@@ -408,6 +408,16 @@ class Package
@activationCommands[selector].push(commands...)
if @metadata.activationEvents?
deprecate """
Use `activationCommands` instead of `activationEvents` in your package.json
Commands should be grouped by selector as follows:
```json
"activationCommands": {
"atom-workspace": ["foo:bar", "foo:baz"],
"atom-text-editor": ["foo:quux"]
}
```
"""
if _.isArray(@metadata.activationEvents)
for eventName in @metadata.activationEvents
@activationCommands['atom-workspace'] ?= []
+4 -3
Ver Arquivo
@@ -8,7 +8,7 @@ class PaneAxisElement extends HTMLElement
detachedCallback: ->
@subscriptions.dispose()
setModel: (@model) ->
initialize: (@model) ->
@subscriptions.add @model.onDidAddChild(@childAdded.bind(this))
@subscriptions.add @model.onDidRemoveChild(@childRemoved.bind(this))
@subscriptions.add @model.onDidReplaceChild(@childReplaced.bind(this))
@@ -20,14 +20,15 @@ class PaneAxisElement extends HTMLElement
@classList.add('horizontal', 'pane-row')
when 'vertical'
@classList.add('vertical', 'pane-column')
this
childAdded: ({child, index}) ->
view = @model.getView(child)
view = atom.views.getView(child)
@insertBefore(view, @children[index])
callAttachHooks(view) # for backward compatibility with SpacePen views
childRemoved: ({child}) ->
view = @model.getView(child)
view = atom.views.getView(child)
view.remove()
childReplaced: ({index, oldChild, newChild}) ->
-3
Ver Arquivo
@@ -39,9 +39,6 @@ class PaneAxis extends Model
getOrientation: -> @orientation
getView: (object) ->
@container.getView(object)
getChildren: -> @children.slice()
getPanes: ->
+4 -3
Ver Arquivo
@@ -11,15 +11,16 @@ class PaneContainerElement extends HTMLElement
PaneContainerView ?= require './pane-container-view'
@__spacePenView = new PaneContainerView(this)
setModel: (@model) ->
initialize: (@model) ->
@subscriptions.add @model.observeRoot(@rootChanged.bind(this))
@__spacePenView.setModel(@model)
this
rootChanged: (root) ->
focusedElement = document.activeElement if @hasFocus()
@firstChild?.remove()
if root?
view = @model.getView(root)
view = atom.views.getView(root)
@appendChild(view)
callAttachHooks(view)
focusedElement?.focus()
@@ -45,7 +46,7 @@ class PaneContainerElement extends HTMLElement
y = pointB.y - pointA.y
Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))
paneView = @model.getView(@model.getActivePane())
paneView = atom.views.getView(@model.getActivePane())
box = @boundingBoxForPaneView(paneView)
paneViews = _.toArray(@querySelectorAll('atom-pane'))
+3 -3
Ver Arquivo
@@ -23,7 +23,7 @@ class PaneContainerView extends View
@subscriptions.add @model.onDidChangeActivePaneItem(@onActivePaneItemChanged)
getRoot: ->
view = @model.getView(@model.getRoot())
view = atom.views.getView(@model.getRoot())
view.__spacePenView ? view
onActivePaneItemChanged: (activeItem) =>
@@ -55,7 +55,7 @@ class PaneContainerView extends View
@getActivePaneView()
getActivePaneView: ->
@model.getView(@model.getActivePane()).__spacePenView
atom.views.getView(@model.getActivePane()).__spacePenView
getActivePaneItem: ->
@model.getActivePaneItem()
@@ -64,7 +64,7 @@ class PaneContainerView extends View
@getActivePaneView()?.activeView
paneForUri: (uri) ->
@model.getView(@model.paneForUri(uri)).__spacePenView
atom.views.getView(@model.paneForUri(uri)).__spacePenView
focusNextPaneView: ->
@model.activateNextPane()
+24 -24
Ver Arquivo
@@ -9,7 +9,6 @@ PaneAxisElement = require './pane-axis-element'
PaneAxis = require './pane-axis'
TextEditor = require './text-editor'
TextEditorElement = require './text-editor-element'
ViewRegistry = require './view-registry'
ItemRegistry = require './item-registry'
module.exports =
@@ -36,7 +35,6 @@ class PaneContainer extends Model
@subscriptions = new CompositeDisposable
@itemRegistry = new ItemRegistry
@viewRegistry = params?.viewRegistry ? new ViewRegistry
@registerViewProviders()
@setRoot(params?.root ? new Pane)
@@ -58,24 +56,14 @@ class PaneContainer extends Model
activePaneId: @activePane.id
registerViewProviders: ->
@viewRegistry.addViewProvider
modelConstructor: PaneContainer
viewConstructor: PaneContainerElement
@viewRegistry.addViewProvider
modelConstructor: PaneAxis
viewConstructor: PaneAxisElement
@viewRegistry.addViewProvider
modelConstructor: Pane
viewConstructor: PaneElement
@viewRegistry.addViewProvider
modelConstructor: TextEditor
viewConstructor: TextEditorElement
getView: (object) ->
@viewRegistry.getView(object)
atom.views.addViewProvider PaneContainer, (model) ->
new PaneContainerElement().initialize(model)
atom.views.addViewProvider PaneAxis, (model) ->
new PaneAxisElement().initialize(model)
atom.views.addViewProvider Pane, (model) ->
new PaneElement().initialize(model)
atom.views.addViewProvider TextEditor, (model) ->
new TextEditorElement().initialize(model)
onDidChangeRoot: (fn) ->
@emitter.on 'did-change-root', fn
@@ -91,6 +79,9 @@ class PaneContainer extends Model
fn(pane) for pane in @getPanes()
@onDidAddPane ({pane}) -> fn(pane)
onDidDestroyPane: (fn) ->
@emitter.on 'did-destroy-pane', fn
onDidChangeActivePane: (fn) ->
@emitter.on 'did-change-active-pane', fn
@@ -112,6 +103,9 @@ class PaneContainer extends Model
fn(@getActivePaneItem())
@onDidChangeActivePaneItem(fn)
onWillDestroyPaneItem: (fn) ->
@emitter.on 'will-destroy-pane-item', fn
onDidDestroyPaneItem: (fn) ->
@emitter.on 'did-destroy-pane-item', fn
@@ -193,11 +187,17 @@ class PaneContainer extends Model
destroyEmptyPanes: ->
pane.destroy() for pane in @getPanes() when pane.items.length is 0
paneItemDestroyed: (item) ->
@emitter.emit 'did-destroy-pane-item', item
willDestroyPaneItem: (event) ->
@emitter.emit 'will-destroy-pane-item', event
didAddPane: (pane) ->
@emitter.emit 'did-add-pane', pane
didDestroyPaneItem: (event) ->
@emitter.emit 'did-destroy-pane-item', event
didAddPane: (event) ->
@emitter.emit 'did-add-pane', event
didDestroyPane: (event) ->
@emitter.emit 'did-destroy-pane', event
# Called by Model superclass when destroyed
destroyed: ->
+7 -6
Ver Arquivo
@@ -43,15 +43,16 @@ class PaneElement extends HTMLElement
createSpacePenShim: ->
@__spacePenView = new PaneView(this)
getModel: -> @model
setModel: (@model) ->
initialize: (@model) ->
@subscriptions.add @model.onDidActivate(@activated.bind(this))
@subscriptions.add @model.observeActive(@activeStatusChanged.bind(this))
@subscriptions.add @model.observeActiveItem(@activeItemChanged.bind(this))
@subscriptions.add @model.onDidRemoveItem(@itemRemoved.bind(this))
@subscriptions.add @model.onDidDestroy(@paneDestroyed.bind(this))
@__spacePenView.setModel(@model)
this
getModel: -> @model
activated: ->
@focus()
@@ -66,7 +67,7 @@ class PaneElement extends HTMLElement
return unless item?
hasFocus = @hasFocus()
itemView = @model.getView(item)
itemView = atom.views.getView(item)
unless @itemViews.contains(itemView)
@itemViews.appendChild(itemView)
@@ -94,14 +95,14 @@ class PaneElement extends HTMLElement
itemView.style.display = 'none'
itemRemoved: ({item, index, destroyed}) ->
if viewToRemove = @model.getView(item)
if viewToRemove = atom.views.getView(item)
callRemoveHooks(viewToRemove) if destroyed
viewToRemove.remove()
paneDestroyed: ->
@subscriptions.dispose()
getActiveView: -> @model.getView(@model.getActiveItem())
getActiveView: -> atom.views.getView(@model.getActiveItem())
hasFocus: ->
this is document.activeElement or @contains(document.activeElement)
+5 -5
Ver Arquivo
@@ -153,15 +153,15 @@ class PaneView extends View
activeItemModifiedChanged: =>
@trigger 'pane:active-item-modified-status-changed'
@::accessor 'activeView', -> @model.getView(@activeItem)?.__spacePenView
@::accessor 'activeView', -> atom.views.getView(@activeItem)?.__spacePenView
splitLeft: (items...) -> @model.getView(@model.splitLeft({items})).__spacePenView
splitLeft: (items...) -> atom.views.getView(@model.splitLeft({items})).__spacePenView
splitRight: (items...) -> @model.getView(@model.splitRight({items})).__spacePenView
splitRight: (items...) -> atom.views.getView(@model.splitRight({items})).__spacePenView
splitUp: (items...) -> @model.getView(@model.splitUp({items})).__spacePenView
splitUp: (items...) -> atom.views.getView(@model.splitUp({items})).__spacePenView
splitDown: (items...) -> @model.getView(@model.splitDown({items})).__spacePenView
splitDown: (items...) -> atom.views.getView(@model.splitDown({items})).__spacePenView
getContainer: -> @closest('atom-pane-container').view()
+5 -4
Ver Arquivo
@@ -53,9 +53,6 @@ class Pane extends Model
params.activeItem = find params.items, (item) -> item.getUri?() is activeItemUri
params
getView: (object) ->
@container.getView(object)
getParent: -> @parent
setParent: (@parent) -> @parent
@@ -371,7 +368,7 @@ class Pane extends Model
@items.splice(index, 1)
@emit 'item-removed', item, index, destroyed
@emitter.emit 'did-remove-item', {item, index, destroyed}
@container?.paneItemDestroyed(item) if destroyed
@container?.didDestroyPaneItem({item, index, pane: this}) if destroyed
@destroy() if @items.length is 0 and atom.config.get('core.destroyEmptyPanes')
# Public: Move the given item to the given index.
@@ -405,11 +402,14 @@ class Pane extends Model
# If the item is active, the next item will be activated. If the item is the
# last item, the pane will be destroyed if the `core.destroyEmptyPanes` config
# setting is `true`.
#
# * `item` Item to destroy
destroyItem: (item) ->
index = @items.indexOf(item)
if index isnt -1
@emit 'before-item-destroyed', item
@emitter.emit 'will-destroy-item', {item, index}
@container?.willDestroyPaneItem({item, index, pane: this})
if @promptToSaveItem(item)
@removeItem(item, true)
item.destroy?()
@@ -536,6 +536,7 @@ class Pane extends Model
@emitter.emit 'did-destroy'
@emitter.dispose()
item.destroy?() for item in @items.slice()
@container?.didDestroyPane(pane: this)
###
Section: Splitting
+6 -5
Ver Arquivo
@@ -4,16 +4,17 @@ class PanelContainerElement extends HTMLElement
createdCallback: ->
@subscriptions = new CompositeDisposable
getModel: -> @model
setModel: (@model) ->
initialize: (@model) ->
@subscriptions.add @model.onDidAddPanel(@panelAdded.bind(this))
@subscriptions.add @model.onDidRemovePanel(@panelRemoved.bind(this))
@subscriptions.add @model.onDidDestroy(@destroyed.bind(this))
@classList.add(@model.getLocation())
this
getModel: -> @model
panelAdded: ({panel, index}) ->
panelElement = panel.getView()
panelElement = atom.views.getView(panel)
panelElement.classList.add(@model.getLocation())
if @model.isModal()
panelElement.classList.add("overlay", "from-top")
@@ -32,7 +33,7 @@ class PanelContainerElement extends HTMLElement
@hideAllPanelsExcept(panel) if visible
panelRemoved: ({panel, index}) ->
@removeChild(panel.getView())
@removeChild(atom.views.getView(panel))
destroyed: ->
@subscriptions.dispose()
+6 -3
Ver Arquivo
@@ -2,7 +2,7 @@
module.exports =
class PanelContainer
constructor: ({@viewRegistry, @location}) ->
constructor: ({@location}={}) ->
@emitter = new Emitter
@subscriptions = new CompositeDisposable
@panels = []
@@ -30,8 +30,6 @@ class PanelContainer
Section: Panels
###
getView: -> @viewRegistry.getView(this)
getLocation: -> @location
isModal: -> @location is 'modal'
@@ -50,6 +48,11 @@ class PanelContainer
@emitter.emit 'did-add-panel', {panel, index}
panel
panelForItem: (item) ->
for panel in @panels
return panel if panel.getItem() is item
null
panelDestroyed: (panel) ->
index = @panels.indexOf(panel)
if index > -1
+9 -6
Ver Arquivo
@@ -5,18 +5,21 @@ class PanelElement extends HTMLElement
createdCallback: ->
@subscriptions = new CompositeDisposable
getModel: -> @model
setModel: (@model) ->
view = @model.getItemView()
@appendChild(view)
initialize: (@model) ->
@appendChild(@getItemView())
@classList.add(@model.getClassName().split(' ')...) if @model.getClassName()?
@subscriptions.add @model.onDidChangeVisible(@visibleChanged.bind(this))
@subscriptions.add @model.onDidDestroy(@destroyed.bind(this))
this
getModel: -> @model
getItemView: ->
atom.views.getView(@model.getItem())
attachedCallback: ->
callAttachHooks(@model.getItemView()) # for backward compatibility with SpacePen views
callAttachHooks(@getItemView()) # for backward compatibility with SpacePen views
@visibleChanged(@model.isVisible())
visibleChanged: (visible) ->
+3 -10
Ver Arquivo
@@ -14,7 +14,7 @@ class Panel
Section: Construction and Destruction
###
constructor: ({@viewRegistry, @item, @visible, @priority, @className}) ->
constructor: ({@item, @visible, @priority, @className}) ->
@emitter = new Emitter
@visible ?= true
@priority ?= 100
@@ -50,15 +50,8 @@ class Panel
Section: Panel Details
###
# Public: Gets this panel model's view DOM node.
#
# Returns an `<atom-panel>` {Element}
getView: -> @viewRegistry.getView(this)
# Public: Gets your panel contents view.
#
# Returns an {Element} or jQuery element, depeneding on how you created the panel.
getItemView: -> @viewRegistry.getView(@item)
# Public: Returns the panel's item.
getItem: -> @item
# Public: Returns a {Number} indicating this panel's priority.
getPriority: -> @priority
+5 -2
Ver Arquivo
@@ -17,7 +17,6 @@ class TextEditorElement extends HTMLElement
focusOnAttach: false
createdCallback: ->
@subscriptions =
@initializeContent()
@createSpacePenShim()
@addEventListener 'focus', @focused.bind(this)
@@ -63,6 +62,10 @@ class TextEditorElement extends HTMLElement
@component.checkForVisibilityChange()
@focus() if @focusOnAttach
initialize: (model) ->
@setModel(model)
this
setModel: (model) ->
throw new Error("Model already assigned on TextEditorElement") if @model?
return if model.isDestroyed()
@@ -71,8 +74,8 @@ class TextEditorElement extends HTMLElement
@mountComponent()
@addGrammarScopeAttribute()
@addMiniAttributeIfNeeded()
@model.onDidChangeGrammar => @addGrammarScopeAttribute()
@addEncodingAttribute()
@model.onDidChangeGrammar => @addGrammarScopeAttribute()
@model.onDidChangeEncoding => @addEncodingAttribute()
@model.onDidDestroy => @unmountComponent()
@__spacePenView.setModel(@model)
+18
Ver Arquivo
@@ -1314,6 +1314,24 @@ class TextEditor extends Model
getDecorations: ->
@displayBuffer.getDecorations()
# Extended: Get all decorations of type 'line'.
#
# Returns an {Array} of {Decoration}s.
getLineDecorations: ->
@displayBuffer.getLineDecorations()
# Extended: Get all decorations of type 'gutter'.
#
# Returns an {Array} of {Decoration}s.
getGutterDecorations: ->
@displayBuffer.getGutterDecorations()
# Extended: Get all decorations of type 'highlight'.
#
# Returns an {Array} of {Decoration}s.
getHighlightDecorations: ->
@displayBuffer.getHighlightDecorations()
# Extended: Get all decorations of type 'overlay'.
#
# Returns an {Array} of {Decoration}s.
+48 -3
Ver Arquivo
@@ -3,6 +3,46 @@ _ = require 'underscore-plus'
{$} = require './space-pen-extensions'
# Essential: Associates tooltips with HTML elements or selectors.
#
# You can get the `TooltipManager` via `atom.tooltips`.
#
# ## Examples
#
# The essence of displaying a tooltip
#
# ```coffee
# # display it
# disposable = atom.tooltips.add(div, {title: 'This is a tooltip'})
#
# # remove it
# disposable.dispose()
# ```
#
# In practice there are usually multiple tooltips. So we add them to a
# CompositeDisposable
#
# ```coffee
# {CompositeDisposable} = require 'atom'
# subscriptions = new CompositeDisposable
#
# div1 = document.createElement('div')
# div2 = document.createElement('div')
# subscriptions.add atom.tooltips.add(div1, {title: 'This is a tooltip'})
# subscriptions.add atom.tooltips.add(div2, {title: 'Another tooltip'})
#
# # remove them all
# subscriptions.dispose()
# ```
#
# You can display a key binding in the tooltip as well with the
# `keyBindingCommand` option.
#
# ```coffee
# disposable = atom.tooltips.add @caseOptionButton,
# title: "Match Case"
# keyBindingCommand: 'find-and-replace:toggle-case-option'
# keyBindingTarget: @findEditor.element
# ```
module.exports =
class TooltipManager
defaults:
@@ -36,15 +76,20 @@ class TooltipManager
if keyBindingCommand?
bindings = atom.keymaps.findKeyBindings(command: keyBindingCommand, target: keyBindingTarget)
if options.title?
keystroke = getKeystroke(bindings)
if options.title? and keystroke?
options.title += " " + getKeystroke(bindings)
else
else if keystroke?
options.title = getKeystroke(bindings)
$target = $(target)
$target.tooltip(_.defaults(options, @defaults))
new Disposable -> $target.tooltip('destroy')
new Disposable ->
tooltip = $target.data('bs.tooltip')
tooltip.leave(currentTarget: target)
tooltip.hide()
$target.tooltip('destroy')
humanizeKeystrokes = (keystroke) ->
keystrokes = keystroke.split(' ')
+12 -5
Ver Arquivo
@@ -1,3 +1,4 @@
Grim = require 'grim'
{Disposable} = require 'event-kit'
# Essential: `ViewRegistry` handles the association between model and view
@@ -10,7 +11,7 @@
# application logic and is the primary point of API interaction. The view
# just handles presentation.
#
# View providers to inform the workspace how your model objects should be
# View providers inform the workspace how your model objects should be
# presented in the DOM. A view provider must always return a DOM node, which
# makes [HTML 5 custom elements](http://www.html5rocks.com/en/tutorials/webcomponents/customelements/)
# an ideal tool for implementing views in Atom.
@@ -76,10 +77,16 @@ class ViewRegistry
#
# Returns a {Disposable} on which `.dispose()` can be called to remove the
# added provider.
addViewProvider: (providerSpec) ->
@providers.push(providerSpec)
addViewProvider: (modelConstructor, createView) ->
if arguments.length is 1
Grim.deprecate("atom.views.addViewProvider now takes 2 arguments: a model constructor and a createView function. See docs for details.")
provider = modelConstructor
else
provider = {modelConstructor, createView}
@providers.push(provider)
new Disposable =>
@providers = @providers.filter (provider) -> provider isnt providerSpec
@providers = @providers.filter (p) -> p isnt provider
# Essential: Get the view associated with an object in the workspace.
#
@@ -131,7 +138,7 @@ class ViewRegistry
element = provider.createView?(object)
unless element?
element = new provider.viewConstructor
element.setModel(object)
element.initialize?(object) ? element.setModel?(object)
element
else if viewConstructor = object?.getViewClass?()
view = new viewConstructor(object)
+19 -9
Ver Arquivo
@@ -1,6 +1,7 @@
path = require 'path'
{$} = require './space-pen-extensions'
_ = require 'underscore-plus'
{Disposable} = require 'event-kit'
ipc = require 'ipc'
shell = require 'shell'
{Subscriber} = require 'emissary'
@@ -32,7 +33,8 @@ class WindowEventHandler
# FIXME: Remove this when deprecations are removed
{releaseVersion, releaseNotes} = detail
detail = [releaseVersion, releaseNotes]
atom.commands.dispatch atom.views.getView(atom.workspace), "window:update-available", detail
if workspaceElement = atom.views.getView(atom.workspace)
atom.commands.dispatch workspaceElement, "window:update-available", detail
@subscribe ipc, 'command', (command, args...) ->
activeElement = document.activeElement
@@ -84,15 +86,13 @@ class WindowEventHandler
document.addEventListener 'keydown', @onKeydown
@subscribe $(document), 'drop', (e) ->
e.preventDefault()
e.stopPropagation()
pathsToOpen = _.pluck(e.originalEvent.dataTransfer.files, 'path')
atom.open({pathsToOpen}) if pathsToOpen.length > 0
document.addEventListener 'drop', @onDrop
@subscribe new Disposable =>
document.removeEventListener('drop', @onDrop)
@subscribe $(document), 'dragover', (e) ->
e.preventDefault()
e.stopPropagation()
document.addEventListener 'dragover', @onDragOver
@subscribe new Disposable =>
document.removeEventListener('dragover', @onKeydown)
@subscribe $(document), 'click', 'a', @openLink
@@ -123,6 +123,16 @@ class WindowEventHandler
atom.keymaps.handleKeyboardEvent(event)
event.stopImmediatePropagation()
onDrop: (event) ->
event.preventDefault()
event.stopPropagation()
pathsToOpen = _.pluck(event.dataTransfer.files, 'path')
atom.open({pathsToOpen}) if pathsToOpen.length > 0
onDragOver: (event) ->
event.preventDefault()
event.stopPropagation()
openLink: ({target, currentTarget}) ->
location = target?.getAttribute('href') or currentTarget?.getAttribute('href')
if location and location[0] isnt '#' and /^https?:\/\//.test(location)
+9 -8
Ver Arquivo
@@ -62,19 +62,17 @@ class WorkspaceElement extends HTMLElement
WorkspaceView ?= require './workspace-view'
@__spacePenView = new WorkspaceView(this)
getModel: -> @model
setModel: (@model) ->
initialize: (@model) ->
@paneContainer = atom.views.getView(@model.paneContainer)
@verticalAxis.appendChild(@paneContainer)
@addEventListener 'focus', @handleFocus.bind(this)
@panelContainers =
top: @model.panelContainers.top.getView()
left: @model.panelContainers.left.getView()
right: @model.panelContainers.right.getView()
bottom: @model.panelContainers.bottom.getView()
modal: @model.panelContainers.modal.getView()
top: atom.views.getView(@model.panelContainers.top)
left: atom.views.getView(@model.panelContainers.left)
right: atom.views.getView(@model.panelContainers.right)
bottom: atom.views.getView(@model.panelContainers.bottom)
modal: atom.views.getView(@model.panelContainers.modal)
@horizontalAxis.insertBefore(@panelContainers.left, @verticalAxis)
@horizontalAxis.appendChild(@panelContainers.right)
@@ -85,6 +83,9 @@ class WorkspaceElement extends HTMLElement
@appendChild(@panelContainers.modal)
@__spacePenView.setModel(@model)
this
getModel: -> @model
setTextEditorFontSize: (fontSize) ->
@updateGlobalEditorStyle('font-size', fontSize + 'px')
+72 -27
Ver Arquivo
@@ -4,7 +4,6 @@ _ = require 'underscore-plus'
{Model} = require 'theorist'
Q = require 'q'
Serializable = require 'serializable'
Delegator = require 'delegato'
{Emitter, Disposable, CompositeDisposable} = require 'event-kit'
Grim = require 'grim'
TextEditor = require './text-editor'
@@ -14,7 +13,6 @@ Panel = require './panel'
PanelElement = require './panel-element'
PanelContainer = require './panel-container'
PanelContainerElement = require './panel-container-element'
ViewRegistry = require './view-registry'
WorkspaceElement = require './workspace-element'
# Essential: Represents the state of the user interface for the entire window.
@@ -31,10 +29,17 @@ class Workspace extends Model
atom.deserializers.add(this)
Serializable.includeInto(this)
@delegatesProperty 'activePane', 'activePaneItem', toProperty: 'paneContainer'
Object.defineProperty @::, 'activePaneItem',
get: ->
Grim.deprecate "Use ::getActivePaneItem() instead of the ::activePaneItem property"
@getActivePaneItem()
Object.defineProperty @::, 'activePane',
get: ->
Grim.deprecate "Use ::getActivePane() instead of the ::activePane property"
@getActivePane()
@properties
viewRegistry: null
paneContainer: null
fullScreen: false
destroyedItemUris: -> []
@@ -45,16 +50,15 @@ class Workspace extends Model
@emitter = new Emitter
@openers = []
viewRegistry = atom.views
@paneContainer ?= new PaneContainer({viewRegistry})
@paneContainer.onDidDestroyPaneItem(@onPaneItemDestroyed)
@paneContainer ?= new PaneContainer()
@paneContainer.onDidDestroyPaneItem(@didDestroyPaneItem)
@panelContainers =
top: new PanelContainer({viewRegistry, location: 'top'})
left: new PanelContainer({viewRegistry, location: 'left'})
right: new PanelContainer({viewRegistry, location: 'right'})
bottom: new PanelContainer({viewRegistry, location: 'bottom'})
modal: new PanelContainer({viewRegistry, location: 'modal'})
top: new PanelContainer({location: 'top'})
left: new PanelContainer({location: 'left'})
right: new PanelContainer({location: 'right'})
bottom: new PanelContainer({location: 'bottom'})
modal: new PanelContainer({location: 'modal'})
@subscribeToActiveItem()
@@ -69,24 +73,20 @@ class Workspace extends Model
when 'atom://.atom/init-script'
@open(atom.getUserInitScriptPath())
atom.views.addViewProvider
modelConstructor: Workspace
viewConstructor: WorkspaceElement
atom.views.addViewProvider Workspace, (model) ->
new WorkspaceElement().initialize(model)
atom.views.addViewProvider
modelConstructor: PanelContainer
viewConstructor: PanelContainerElement
atom.views.addViewProvider PanelContainer, (model) ->
new PanelContainerElement().initialize(model)
atom.views.addViewProvider
modelConstructor: Panel
viewConstructor: PanelElement
atom.views.addViewProvider Panel, (model) ->
new PanelElement().initialize(model)
# Called by the Serializable mixin during deserialization
deserializeParams: (params) ->
for packageName in params.packagesWithActiveGrammars ? []
atom.packages.getLoadedPackage(packageName)?.loadGrammarsSync()
params.paneContainer.viewRegistry = atom.views
params.paneContainer = PaneContainer.deserialize(params.paneContainer)
params
@@ -240,6 +240,16 @@ class Workspace extends Model
# Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.
onDidAddPane: (callback) -> @paneContainer.onDidAddPane(callback)
# Extended: Invoke the given callback when a pane is destroyed in the
# workspace.
#
# * `callback` {Function} to be called panes are destroyed.
# * `event` {Object} with the following keys:
# * `pane` The destroyed pane.
#
# Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.
onDidDestroyPane: (callback) -> @paneContainer.onDidDestroyPane(callback)
# Extended: Invoke the given callback with all current and future panes in the
# workspace.
#
@@ -271,7 +281,7 @@ class Workspace extends Model
# Extended: Invoke the given callback when a pane item is added to the
# workspace.
#
# * `callback` {Function} to be called when panes are added.
# * `callback` {Function} to be called when pane items are added.
# * `event` {Object} with the following keys:
# * `item` The added pane item.
# * `pane` {Pane} containing the added item.
@@ -280,6 +290,31 @@ class Workspace extends Model
# Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.
onDidAddPaneItem: (callback) -> @paneContainer.onDidAddPaneItem(callback)
# Extended: Invoke the given callback when a pane item is about to be
# destroyed, before the user is prompted to save it.
#
# * `callback` {Function} to be called before pane items are destroyed.
# * `event` {Object} with the following keys:
# * `item` The item to be destroyed.
# * `pane` {Pane} containing the item to be destroyed.
# * `index` {Number} indicating the index of the item to be destroyed in
# its pane.
#
# Returns a {Disposable} on which `.dispose` can be called to unsubscribe.
onWillDestroyPaneItem: (callback) -> @paneContainer.onWillDestroyPaneItem(callback)
# Extended: Invoke the given callback when a pane item is destroyed.
#
# * `callback` {Function} to be called when pane items are destroyed.
# * `event` {Object} with the following keys:
# * `item` The destroyed item.
# * `pane` {Pane} containing the destroyed item.
# * `index` {Number} indicating the index of the destroyed item in its
# pane.
#
# Returns a {Disposable} on which `.dispose` can be called to unsubscribe.
onDidDestroyPaneItem: (callback) -> @paneContainer.onDidDestroyPaneItem(callback)
# Extended: Invoke the given callback when a text editor is added to the
# workspace.
#
@@ -503,9 +538,10 @@ class Workspace extends Model
activeItem = @getActivePaneItem()
activeItem if activeItem instanceof TextEditor
# Deprecated:
# Deprecated
getActiveEditor: ->
@activePane?.getActiveEditor()
Grim.deprecate "Call ::getActiveTextEditor instead"
@getActivePane()?.getActiveEditor()
# Save all pane items.
saveAll: ->
@@ -605,7 +641,7 @@ class Workspace extends Model
_.remove(@destroyedItemUris, uri)
# Adds the destroyed item's uri to the list of items to reopen.
onPaneItemDestroyed: (item) =>
didDestroyPaneItem: ({item}) =>
if uri = item.getUri?()
@destroyedItemUris.push(uri)
@@ -714,10 +750,19 @@ class Workspace extends Model
addModalPanel: (options={}) ->
@addPanel('modal', options)
# Essential: Returns the {Panel} associated with the given item. Returns
# `null` when the item has no panel.
#
# * `item` Item the panel contains
panelForItem: (item) ->
for location, container of @panelContainers
panel = container.panelForItem(item)
return panel if panel?
null
getPanels: (location) ->
@panelContainers[location].getPanels()
addPanel: (location, options) ->
options ?= {}
options.viewRegistry = atom.views
@panelContainers[location].addPanel(new Panel(options))
+12 -14
Ver Arquivo
@@ -1,19 +1,17 @@
.source {
.gfm {
.markup.heading {
font-weight: bold;
}
.source.gfm {
.markup.heading {
font-weight: bold;
}
.bold {
font-weight: bold;
}
.bold {
font-weight: bold;
}
.italic {
font-style: italic;
}
.italic {
font-style: italic;
}
.comment.quote {
font-style: italic;
}
.comment.quote {
font-style: italic;
}
}