Comparar commits
109 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| aa180e1498 | |||
| 3093a35554 | |||
| 3839432654 | |||
| 0a66e9d21e | |||
| 3dbdfe54ad | |||
| 485fc62d22 | |||
| a0f8405457 | |||
| 56da4f49d4 | |||
| 76b7a8cec9 | |||
| de987d3fd2 | |||
| 1a09ec6b92 | |||
| 149cfdf0c2 | |||
| d522438876 | |||
| 8fe72cd469 | |||
| 51a950c419 | |||
| e693254913 | |||
| 170a71f416 | |||
| e8c19300b5 | |||
| 045850ba06 | |||
| 366ded2f5e | |||
| 716682f072 | |||
| 29ee7cc76b | |||
| 98fe40546e | |||
| 6765eeba1a | |||
| 1c638129be | |||
| ae2ce9a1f9 | |||
| b3de4a593d | |||
| dc22592512 | |||
| 85208d197d | |||
| 277d3ea4ff | |||
| 6d661692df | |||
| 14a75b8605 | |||
| 9564fdb48f | |||
| d5e4f051be | |||
| 8c1ee8a759 | |||
| ad64017b7a | |||
| 4ebf748fd7 | |||
| f0b9b9eb6c | |||
| 49cd3eb5da | |||
| ab4588571d | |||
| 0097e6246e | |||
| 296409d9d0 | |||
| 7f8ab72f53 | |||
| 7f2e118abc | |||
| 415a7e3214 | |||
| 1f3708115e | |||
| 55c8b37395 | |||
| 9d3e9d19e1 | |||
| 432c31c4dc | |||
| e257395f7d | |||
| 3f224716a1 | |||
| 640f8920fb | |||
| c015a5c03b | |||
| 88f489715f | |||
| f48a7ac210 | |||
| 44939a12a0 | |||
| b256d30bc7 | |||
| 574c56713c | |||
| b8822b32db | |||
| 8c39818670 | |||
| 5a2c208804 | |||
| fc899f54cf | |||
| c480080dd2 | |||
| b923b57bcc | |||
| 1609b6c51b | |||
| 66e30dd38a | |||
| ec96c5f1fc | |||
| 319ec244e1 | |||
| 1267a1e14e | |||
| 0411f1584c | |||
| 9dc9359e7c | |||
| 47668306bd | |||
| 09920548e8 | |||
| dea4e4dc19 | |||
| 95ae4a704e | |||
| 903df93933 | |||
| 4bc6906bdc | |||
| f6f71db9ee | |||
| aca8dc3dfb | |||
| 8e0e6f5508 | |||
| c4d38a738b | |||
| eee31c3e8c | |||
| f40d2fb1cc | |||
| 8c30f5fe3f | |||
| e69bd77ef2 | |||
| 1c57a48287 | |||
| e5a1f15833 | |||
| 8a13c4b959 | |||
| 36c0d214f0 | |||
| ae859bad46 | |||
| 1207a432eb | |||
| 2f31822942 | |||
| dea75513b5 | |||
| c3a2b3d321 | |||
| 97dd53cbdb | |||
| dd80226c23 | |||
| 6926236268 | |||
| 43f57347d7 | |||
| c0b78db159 | |||
| 002918049d | |||
| f00b0b7f7a | |||
| 6ef8c21977 | |||
| 9b2ec09bf1 | |||
| 52e91932e0 | |||
| acd34ffaf8 | |||
| 2f62346c58 | |||
| f59ffc2485 | |||
| 3090a24957 | |||
| f946061b6c |
@@ -99,6 +99,10 @@ For more information on how to work with Atom's official packages, see
|
||||
* Avoid spaces inside the curly-braces of hash literals:
|
||||
* `{a: 1, b: 2}` instead of `{ a: 1, b: 2 }`
|
||||
* Include a single line of whitespace between methods.
|
||||
* Capitalize initialisms and acronyms in names, except for the first word, which
|
||||
should be lower-case:
|
||||
* `getURI` instead of `getUri`
|
||||
* `uriToOpen` instead of `URIToOpen`
|
||||
|
||||
## Documentation Styleguide
|
||||
|
||||
|
||||
+1
-1
@@ -6,6 +6,6 @@
|
||||
"url": "https://github.com/atom/atom.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"atom-package-manager": "0.118.0"
|
||||
"atom-package-manager": "0.120.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,6 +198,7 @@ module.exports = (grunt) ->
|
||||
outputDir: 'atom-shell'
|
||||
downloadDir: atomShellDownloadDir
|
||||
rebuild: true # rebuild native modules after atom-shell is updated
|
||||
token: process.env.ATOM_ACCESS_TOKEN
|
||||
|
||||
'create-windows-installer':
|
||||
appDirectory: shellAppDir
|
||||
@@ -205,6 +206,7 @@ module.exports = (grunt) ->
|
||||
authors: 'GitHub Inc.'
|
||||
loadingGif: path.resolve(__dirname, '..', 'resources', 'win', 'loading.gif')
|
||||
iconUrl: 'https://raw.githubusercontent.com/atom/atom/master/resources/win/atom.ico'
|
||||
setupIcon: path.resolve(__dirname, '..', 'resources', 'win', 'atom.ico')
|
||||
|
||||
shell:
|
||||
'kill-atom':
|
||||
|
||||
@@ -12,19 +12,19 @@
|
||||
"fs-plus": "2.x",
|
||||
"github-releases": "~0.2.0",
|
||||
"grunt": "~0.4.1",
|
||||
"grunt-atom-shell-installer": "^0.16.0",
|
||||
"grunt-atom-shell-installer": "^0.19.0",
|
||||
"grunt-cli": "~0.1.9",
|
||||
"grunt-coffeelint": "git+https://github.com/atom/grunt-coffeelint.git#cfb99aa99811d52687969532bd5a98011ed95bfe",
|
||||
"grunt-contrib-coffee": "~0.9.0",
|
||||
"grunt-contrib-coffee": "~0.12.0",
|
||||
"grunt-contrib-csslint": "~0.1.2",
|
||||
"grunt-contrib-less": "~0.8.0",
|
||||
"grunt-cson": "0.10.0",
|
||||
"grunt-download-atom-shell": "~0.10.0",
|
||||
"grunt-cson": "0.14.0",
|
||||
"grunt-download-atom-shell": "~0.11.0",
|
||||
"grunt-lesslint": "0.13.0",
|
||||
"grunt-peg": "~1.1.0",
|
||||
"grunt-shell": "~0.3.1",
|
||||
"harmony-collections": "~0.3.8",
|
||||
"legal-eagle": "~0.6.0",
|
||||
"legal-eagle": "~0.8.0",
|
||||
"minidump": "~0.8",
|
||||
"npm": "~1.4.5",
|
||||
"rcedit": "~0.3.0",
|
||||
|
||||
@@ -38,7 +38,7 @@ In addition to the regular [npm package.json keys][npm-keys] available, Atom
|
||||
package.json files have their own additions.
|
||||
|
||||
- `main` (**Required**): the path to the CoffeeScript file that's the entry point
|
||||
to your package
|
||||
to your package.
|
||||
- `styles` (**Optional**): an Array of Strings identifying the order of the
|
||||
style sheets your package needs to load. If not specified, style sheets in the
|
||||
_styles_ directory are added alphabetically.
|
||||
|
||||
@@ -127,3 +127,10 @@ describe "when a test is written", ->
|
||||
expect("apples").toEqual("apples")
|
||||
expect("oranges").not.toEqual("apples")
|
||||
```
|
||||
|
||||
### Running on CI
|
||||
|
||||
It is now easy to run the specs in a CI environment like Travis and AppVeyor. See the
|
||||
[Travis CI For Your Packages](http://blog.atom.io/2014/04/25/ci-for-your-packages.html)
|
||||
and [AppVeyor CI For Your Packages](http://blog.atom.io/2014/07/28/windows-ci-for-your-packages.html)
|
||||
posts for more details.
|
||||
|
||||
@@ -12,10 +12,14 @@
|
||||
|
||||
}
|
||||
|
||||
// style the background and foreground colors on the atom-text-editor-element
|
||||
// itself
|
||||
atom-text-editor {
|
||||
|
||||
}
|
||||
|
||||
atom-text-editor .cursor {
|
||||
// To style other content in the text editor's shadow DOM, use the ::shadow
|
||||
// expression
|
||||
atom-text-editor::shadow .cursor {
|
||||
|
||||
}
|
||||
|
||||
+20
-18
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "atom",
|
||||
"productName": "Atom",
|
||||
"version": "0.170.0",
|
||||
"version": "0.173.0",
|
||||
"description": "A hackable text editor for the 21st Century.",
|
||||
"main": "./src/browser/main.js",
|
||||
"repository": {
|
||||
@@ -20,15 +20,16 @@
|
||||
"atomShellVersion": "0.20.5",
|
||||
"dependencies": {
|
||||
"async": "0.2.6",
|
||||
"atom-keymap": "^2.5.0",
|
||||
"atom-keymap": "^2.5.2",
|
||||
"bootstrap": "git+https://github.com/atom/bootstrap.git#6af81906189f1747fd6c93479e3d998ebe041372",
|
||||
"clear-cut": "0.4.0",
|
||||
"coffee-script": "1.7.0",
|
||||
"coffeestack": "0.7.0",
|
||||
"coffee-script": "1.8.0",
|
||||
"coffeestack": "0.8.0",
|
||||
"color": "^0.7.3",
|
||||
"delegato": "^1",
|
||||
"emissary": "^1.3.1",
|
||||
"event-kit": "^1.0.1",
|
||||
"first-mate": "^2.2.3",
|
||||
"first-mate": "^2.2.4",
|
||||
"fs-plus": "^2.3.2",
|
||||
"fstream": "0.1.24",
|
||||
"fuzzaldrin": "^2.1",
|
||||
@@ -49,17 +50,18 @@
|
||||
"property-accessors": "^1",
|
||||
"q": "^1.0.1",
|
||||
"random-words": "0.0.1",
|
||||
"react-atom-fork": "^0.11.1",
|
||||
"react-atom-fork": "^0.11.4",
|
||||
"reactionary-atom-fork": "^1.0.0",
|
||||
"runas": "1.0.1",
|
||||
"scandal": "1.0.3",
|
||||
"scoped-property-store": "^0.16.2",
|
||||
"scrollbar-style": "^1.0.2",
|
||||
"season": "^1.0.2",
|
||||
"season": "^5.0.5",
|
||||
"semver": "2.2.1",
|
||||
"serializable": "^1",
|
||||
"service-hub": "^0.1.0",
|
||||
"space-pen": "3.8.2",
|
||||
"stacktrace-parser": "0.1.1",
|
||||
"temp": "0.7.0",
|
||||
"text-buffer": "^3.8.4",
|
||||
"theorist": "^1.0.2",
|
||||
@@ -76,14 +78,14 @@
|
||||
"solarized-dark-syntax": "0.30.0",
|
||||
"solarized-light-syntax": "0.17.0",
|
||||
"archive-view": "0.43.0",
|
||||
"autocomplete": "0.41.0",
|
||||
"autocomplete": "0.42.0",
|
||||
"autoflow": "0.20.0",
|
||||
"autosave": "0.19.0",
|
||||
"background-tips": "0.20.0",
|
||||
"bookmarks": "0.33.0",
|
||||
"bracket-matcher": "0.67.0",
|
||||
"command-palette": "0.32.0",
|
||||
"deprecation-cop": "0.25.0",
|
||||
"deprecation-cop": "0.28.0",
|
||||
"dev-live-reload": "0.36.0",
|
||||
"encoding-selector": "0.14.0",
|
||||
"exception-reporting": "0.21.0",
|
||||
@@ -96,19 +98,19 @@
|
||||
"incompatible-packages": "0.19.0",
|
||||
"keybinding-resolver": "0.25.0",
|
||||
"link": "0.29.0",
|
||||
"markdown-preview": "0.116.0",
|
||||
"markdown-preview": "0.117.0",
|
||||
"metrics": "0.40.0",
|
||||
"notifications": "0.23.0",
|
||||
"notifications": "0.24.0",
|
||||
"open-on-github": "0.32.0",
|
||||
"package-generator": "0.36.0",
|
||||
"release-notes": "0.45.0",
|
||||
"settings-view": "0.167.0",
|
||||
"snippets": "0.66.0",
|
||||
"settings-view": "0.172.0",
|
||||
"snippets": "0.67.0",
|
||||
"spell-check": "0.49.0",
|
||||
"status-bar": "0.56.0",
|
||||
"styleguide": "0.39.0",
|
||||
"status-bar": "0.57.0",
|
||||
"styleguide": "0.41.0",
|
||||
"symbols-view": "0.77.0",
|
||||
"tabs": "0.61.0",
|
||||
"tabs": "0.62.0",
|
||||
"timecop": "0.26.0",
|
||||
"tree-view": "0.147.0",
|
||||
"update-package-dependencies": "0.7.0",
|
||||
@@ -119,9 +121,9 @@
|
||||
"language-clojure": "0.10.0",
|
||||
"language-coffee-script": "0.39.0",
|
||||
"language-css": "0.26.0",
|
||||
"language-gfm": "0.61.0",
|
||||
"language-gfm": "0.62.0",
|
||||
"language-git": "0.10.0",
|
||||
"language-go": "0.20.0",
|
||||
"language-go": "0.21.0",
|
||||
"language-html": "0.28.0",
|
||||
"language-hyperlink": "0.12.2",
|
||||
"language-java": "0.14.0",
|
||||
|
||||
@@ -1060,6 +1060,9 @@ describe "Config", ->
|
||||
type: 'integer'
|
||||
default: 12
|
||||
|
||||
expect(atom.config.getSchema('foo.baz')).toBeUndefined()
|
||||
expect(atom.config.getSchema('foo.bar.anInt.baz')).toBeUndefined()
|
||||
|
||||
it "respects the schema for scoped settings", ->
|
||||
schema =
|
||||
type: 'string'
|
||||
@@ -1287,6 +1290,79 @@ describe "Config", ->
|
||||
atom.config.set 'foo.bar', ['2', '3', '4']
|
||||
expect(atom.config.get('foo.bar')).toEqual [2, 3, 4]
|
||||
|
||||
describe 'when the value has a "color" type', ->
|
||||
beforeEach ->
|
||||
schema =
|
||||
type: 'color'
|
||||
default: 'white'
|
||||
atom.config.setSchema('foo.bar.aColor', schema)
|
||||
|
||||
it 'returns a Color object', ->
|
||||
color = atom.config.get('foo.bar.aColor')
|
||||
expect(color.toHexString()).toBe '#ffffff'
|
||||
expect(color.toRGBAString()).toBe 'rgba(255, 255, 255, 1)'
|
||||
|
||||
color.red = 0
|
||||
color.green = 0
|
||||
color.blue = 0
|
||||
color.alpha = 0
|
||||
atom.config.set('foo.bar.aColor', color)
|
||||
|
||||
color = atom.config.get('foo.bar.aColor')
|
||||
expect(color.toHexString()).toBe '#000000'
|
||||
expect(color.toRGBAString()).toBe 'rgba(0, 0, 0, 0)'
|
||||
|
||||
color.red = 300
|
||||
color.green = -200
|
||||
color.blue = -1
|
||||
color.alpha = 'not see through'
|
||||
atom.config.set('foo.bar.aColor', color)
|
||||
|
||||
color = atom.config.get('foo.bar.aColor')
|
||||
expect(color.toHexString()).toBe '#ff0000'
|
||||
expect(color.toRGBAString()).toBe 'rgba(255, 0, 0, 1)'
|
||||
|
||||
it 'coerces various types to a color object', ->
|
||||
atom.config.set('foo.bar.aColor', 'red')
|
||||
expect(atom.config.get('foo.bar.aColor')).toEqual {red: 255, green: 0, blue: 0, alpha: 1}
|
||||
atom.config.set('foo.bar.aColor', '#020')
|
||||
expect(atom.config.get('foo.bar.aColor')).toEqual {red: 0, green: 34, blue: 0, alpha: 1}
|
||||
atom.config.set('foo.bar.aColor', '#abcdef')
|
||||
expect(atom.config.get('foo.bar.aColor')).toEqual {red: 171, green: 205, blue: 239, alpha: 1}
|
||||
atom.config.set('foo.bar.aColor', 'rgb(1,2,3)')
|
||||
expect(atom.config.get('foo.bar.aColor')).toEqual {red: 1, green: 2, blue: 3, alpha: 1}
|
||||
atom.config.set('foo.bar.aColor', 'rgba(4,5,6,.7)')
|
||||
expect(atom.config.get('foo.bar.aColor')).toEqual {red: 4, green: 5, blue: 6, alpha: .7}
|
||||
atom.config.set('foo.bar.aColor', 'hsl(120,100%,50%)')
|
||||
expect(atom.config.get('foo.bar.aColor')).toEqual {red: 0, green: 255, blue: 0, alpha: 1}
|
||||
atom.config.set('foo.bar.aColor', 'hsla(120,100%,50%,0.3)')
|
||||
expect(atom.config.get('foo.bar.aColor')).toEqual {red: 0, green: 255, blue: 0, alpha: .3}
|
||||
atom.config.set('foo.bar.aColor', {red: 100, green: 255, blue: 2, alpha: .5})
|
||||
expect(atom.config.get('foo.bar.aColor')).toEqual {red: 100, green: 255, blue: 2, alpha: .5}
|
||||
atom.config.set('foo.bar.aColor', {red: 255})
|
||||
expect(atom.config.get('foo.bar.aColor')).toEqual {red: 255, green: 0, blue: 0, alpha: 1}
|
||||
atom.config.set('foo.bar.aColor', {red: 1000})
|
||||
expect(atom.config.get('foo.bar.aColor')).toEqual {red: 255, green: 0, blue: 0, alpha: 1}
|
||||
atom.config.set('foo.bar.aColor', {red: 'dark'})
|
||||
expect(atom.config.get('foo.bar.aColor')).toEqual {red: 0, green: 0, blue: 0, alpha: 1}
|
||||
|
||||
it 'reverts back to the default value when undefined is passed to set', ->
|
||||
atom.config.set('foo.bar.aColor', undefined)
|
||||
expect(atom.config.get('foo.bar.aColor')).toEqual {red: 255, green: 255, blue: 255, alpha: 1}
|
||||
|
||||
it 'will not set non-colors', ->
|
||||
atom.config.set('foo.bar.aColor', null)
|
||||
expect(atom.config.get('foo.bar.aColor')).toEqual {red: 255, green: 255, blue: 255, alpha: 1}
|
||||
|
||||
atom.config.set('foo.bar.aColor', 'nope')
|
||||
expect(atom.config.get('foo.bar.aColor')).toEqual {red: 255, green: 255, blue: 255, alpha: 1}
|
||||
|
||||
atom.config.set('foo.bar.aColor', 30)
|
||||
expect(atom.config.get('foo.bar.aColor')).toEqual {red: 255, green: 255, blue: 255, alpha: 1}
|
||||
|
||||
atom.config.set('foo.bar.aColor', false)
|
||||
expect(atom.config.get('foo.bar.aColor')).toEqual {red: 255, green: 255, blue: 255, alpha: 1}
|
||||
|
||||
describe 'when the `enum` key is used', ->
|
||||
beforeEach ->
|
||||
schema =
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class TestItem
|
||||
getUri: -> "test"
|
||||
|
||||
exports.activate = ->
|
||||
atom.workspace.addOpener -> new TestItem
|
||||
@@ -129,7 +129,7 @@ describe "PaneContainer", ->
|
||||
beforeEach ->
|
||||
class TestItem
|
||||
shouldPromptToSave: -> true
|
||||
getUri: -> 'test'
|
||||
getURI: -> 'test'
|
||||
|
||||
container = new PaneContainer
|
||||
container.getRoot().splitRight()
|
||||
|
||||
@@ -16,7 +16,7 @@ describe "PaneContainerView", ->
|
||||
@content: -> @div tabindex: -1
|
||||
initialize: (@name) -> @text(@name)
|
||||
serialize: -> { deserializer: 'TestView', @name }
|
||||
getUri: -> path.join(temp.dir, @name)
|
||||
getURI: -> path.join(temp.dir, @name)
|
||||
save: -> @saved = true
|
||||
isEqual: (other) -> @name is other?.name
|
||||
onDidChangeTitle: -> new Disposable(->)
|
||||
|
||||
+12
-12
@@ -9,7 +9,7 @@ describe "Pane", ->
|
||||
class Item extends Model
|
||||
@deserialize: ({name, uri}) -> new this(name, uri)
|
||||
constructor: (@name, @uri) ->
|
||||
getUri: -> @uri
|
||||
getURI: -> @uri
|
||||
getPath: -> @path
|
||||
serialize: -> {deserializer: 'Item', @name, @uri}
|
||||
isEqual: (other) -> @name is other?.name
|
||||
@@ -231,18 +231,18 @@ describe "Pane", ->
|
||||
expect(pane.getActiveItem()).toBe item1
|
||||
|
||||
describe "if the item is modified", ->
|
||||
itemUri = null
|
||||
itemURI = null
|
||||
|
||||
beforeEach ->
|
||||
item1.shouldPromptToSave = -> true
|
||||
item1.save = jasmine.createSpy("save")
|
||||
item1.saveAs = jasmine.createSpy("saveAs")
|
||||
item1.getUri = -> itemUri
|
||||
item1.getURI = -> itemURI
|
||||
|
||||
describe "if the [Save] option is selected", ->
|
||||
describe "when the item has a uri", ->
|
||||
it "saves the item before destroying it", ->
|
||||
itemUri = "test"
|
||||
itemURI = "test"
|
||||
spyOn(atom, 'confirm').andReturn(0)
|
||||
pane.destroyItem(item1)
|
||||
|
||||
@@ -252,7 +252,7 @@ describe "Pane", ->
|
||||
|
||||
describe "when the item has no uri", ->
|
||||
it "presents a save-as dialog, then saves the item with the given uri before removing and destroying it", ->
|
||||
itemUri = null
|
||||
itemURI = null
|
||||
|
||||
spyOn(atom, 'showSaveDialogSync').andReturn("/selected/path")
|
||||
spyOn(atom, 'confirm').andReturn(0)
|
||||
@@ -404,15 +404,15 @@ describe "Pane", ->
|
||||
pane.saveActiveItemAs()
|
||||
expect(atom.showSaveDialogSync).not.toHaveBeenCalled()
|
||||
|
||||
describe "::itemForUri(uri)", ->
|
||||
it "returns the item for which a call to .getUri() returns the given uri", ->
|
||||
describe "::itemForURI(uri)", ->
|
||||
it "returns the item for which a call to .getURI() returns the given uri", ->
|
||||
pane = new Pane(items: [new Item("A"), new Item("B"), new Item("C"), new Item("D")])
|
||||
[item1, item2, item3] = pane.getItems()
|
||||
item1.uri = "a"
|
||||
item2.uri = "b"
|
||||
expect(pane.itemForUri("a")).toBe item1
|
||||
expect(pane.itemForUri("b")).toBe item2
|
||||
expect(pane.itemForUri("bogus")).toBeUndefined()
|
||||
expect(pane.itemForURI("a")).toBe item1
|
||||
expect(pane.itemForURI("b")).toBe item2
|
||||
expect(pane.itemForURI("bogus")).toBeUndefined()
|
||||
|
||||
describe "::moveItem(item, index)", ->
|
||||
[pane, item1, item2, item3, item4] = []
|
||||
@@ -589,7 +589,7 @@ describe "Pane", ->
|
||||
[item1, item2] = pane.getItems()
|
||||
|
||||
item1.shouldPromptToSave = -> true
|
||||
item1.getUri = -> "/test/path"
|
||||
item1.getURI = -> "/test/path"
|
||||
item1.save = jasmine.createSpy("save")
|
||||
|
||||
spyOn(atom, 'confirm').andReturn(0)
|
||||
@@ -604,7 +604,7 @@ describe "Pane", ->
|
||||
[item1, item2] = pane.getItems()
|
||||
|
||||
item1.shouldPromptToSave = -> true
|
||||
item1.getUri = -> "/test/path"
|
||||
item1.getURI = -> "/test/path"
|
||||
item1.save = jasmine.createSpy("save")
|
||||
|
||||
spyOn(atom, 'confirm').andReturn(1)
|
||||
|
||||
@@ -15,7 +15,7 @@ describe "PaneView", ->
|
||||
initialize: ({@id, @text}) ->
|
||||
@emitter = new Emitter
|
||||
serialize: -> { deserializer: 'TestView', @id, @text }
|
||||
getUri: -> @id
|
||||
getURI: -> @id
|
||||
isEqual: (other) -> other? and @id == other.id and @text == other.text
|
||||
changeTitle: ->
|
||||
@emitter.emit 'did-change-title', 'title'
|
||||
|
||||
@@ -119,6 +119,7 @@ beforeEach ->
|
||||
"package-with-broken-package-json", "package-with-broken-keymap"]
|
||||
config.set "editor.useShadowDOM", true
|
||||
advanceClock(1000)
|
||||
window.setTimeout.reset()
|
||||
config.load.reset()
|
||||
config.save.reset()
|
||||
|
||||
|
||||
@@ -552,14 +552,29 @@ describe "TextEditorComponent", ->
|
||||
nextAnimationFrame()
|
||||
expect(lineNumbersNode.style.backgroundColor).toBe 'rgb(255, 0, 0)'
|
||||
|
||||
describe "when the editor.showLineNumbers config is false", ->
|
||||
it "doesn't render any line numbers", ->
|
||||
expect(component.refs.gutter).toBeDefined()
|
||||
atom.config.set("editor.showLineNumbers", false)
|
||||
expect(component.refs.gutter).not.toBeDefined()
|
||||
atom.config.set("editor.showLineNumbers", true)
|
||||
expect(component.refs.gutter).toBeDefined()
|
||||
expect(component.lineNumberNodeForScreenRow(3)).toBeDefined()
|
||||
it "hides or shows the gutter based on the '::isGutterVisible' property on the model and the global 'editor.showLineNumbers' config setting", ->
|
||||
expect(component.refs.gutter?).toBe true
|
||||
|
||||
editor.setGutterVisible(false)
|
||||
nextAnimationFrame()
|
||||
|
||||
expect(component.refs.gutter?).toBe false
|
||||
|
||||
atom.config.set("editor.showLineNumbers", false)
|
||||
expect(nextAnimationFrame).toBe noAnimationFrame
|
||||
|
||||
expect(component.refs.gutter?).toBe false
|
||||
|
||||
editor.setGutterVisible(true)
|
||||
expect(nextAnimationFrame).toBe noAnimationFrame
|
||||
|
||||
expect(component.refs.gutter?).toBe false
|
||||
|
||||
atom.config.set("editor.showLineNumbers", true)
|
||||
nextAnimationFrame()
|
||||
|
||||
expect(component.refs.gutter?).toBe true
|
||||
expect(component.lineNumberNodeForScreenRow(3)?).toBe true
|
||||
|
||||
describe "fold decorations", ->
|
||||
describe "rendering fold decorations", ->
|
||||
@@ -2502,7 +2517,8 @@ describe "TextEditorComponent", ->
|
||||
|
||||
describe "when the 'mini' property is true", ->
|
||||
beforeEach ->
|
||||
component.setProps(mini: true)
|
||||
editor.setMini(true)
|
||||
nextAnimationFrame()
|
||||
|
||||
it "does not render the gutter", ->
|
||||
expect(componentNode.querySelector('.gutter')).toBeNull()
|
||||
|
||||
@@ -10,16 +10,21 @@ describe "TextEditorElement", ->
|
||||
jasmineContent = document.body.querySelector('#jasmine-content')
|
||||
|
||||
describe "instantiation", ->
|
||||
it "honors the mini attribute", ->
|
||||
it "honors the 'mini' attribute", ->
|
||||
jasmineContent.innerHTML = "<atom-text-editor mini>"
|
||||
element = jasmineContent.firstChild
|
||||
expect(element.getModel().isMini()).toBe true
|
||||
|
||||
it "honors the placeholder-text attribute", ->
|
||||
it "honors the 'placeholder-text' attribute", ->
|
||||
jasmineContent.innerHTML = "<atom-text-editor placeholder-text='testing'>"
|
||||
element = jasmineContent.firstChild
|
||||
expect(element.getModel().getPlaceholderText()).toBe 'testing'
|
||||
|
||||
it "honors the 'gutter-hidden' attribute", ->
|
||||
jasmineContent.innerHTML = "<atom-text-editor gutter-hidden>"
|
||||
element = jasmineContent.firstChild
|
||||
expect(element.getModel().isGutterVisible()).toBe false
|
||||
|
||||
it "honors the text content", ->
|
||||
jasmineContent.innerHTML = "<atom-text-editor>testing</atom-text-editor>"
|
||||
element = jasmineContent.firstChild
|
||||
|
||||
@@ -169,6 +169,14 @@ describe "Window", ->
|
||||
$("<a href='#scroll-me'>link</a>").appendTo(document.body).click().remove()
|
||||
expect(shell.openExternal).not.toHaveBeenCalled()
|
||||
|
||||
describe "when a form is submitted", ->
|
||||
it "prevents the default so that the window's URL isn't changed", ->
|
||||
submitSpy = jasmine.createSpy('submit')
|
||||
$(document).on('submit', 'form', submitSpy)
|
||||
$("<form>foo</form>").appendTo(document.body).submit().remove()
|
||||
expect(submitSpy.callCount).toBe 1
|
||||
expect(submitSpy.argsForCall[0][0].isDefaultPrevented()).toBe true
|
||||
|
||||
describe "core:focus-next and core:focus-previous", ->
|
||||
describe "when there is no currently focused element", ->
|
||||
it "focuses the element with the lowest/highest tabindex", ->
|
||||
|
||||
@@ -6,6 +6,7 @@ platform = require './spec-helper-platform'
|
||||
_ = require 'underscore-plus'
|
||||
fstream = require 'fstream'
|
||||
fs = require 'fs-plus'
|
||||
Grim = require 'grim'
|
||||
|
||||
describe "Workspace", ->
|
||||
workspace = null
|
||||
@@ -96,7 +97,7 @@ describe "Workspace", ->
|
||||
workspace.open('a').then (o) -> editor = o
|
||||
|
||||
runs ->
|
||||
expect(editor.getUri()).toBe atom.project.getDirectories()[0]?.resolve('a')
|
||||
expect(editor.getURI()).toBe atom.project.getDirectories()[0]?.resolve('a')
|
||||
expect(workspace.getActivePaneItem()).toBe editor
|
||||
expect(workspace.getActivePane().items).toEqual [editor]
|
||||
expect(workspace.getActivePane().activate).toHaveBeenCalled()
|
||||
@@ -250,6 +251,21 @@ describe "Workspace", ->
|
||||
runs ->
|
||||
expect(newEditorHandler.argsForCall[0][0].textEditor).toBe editor
|
||||
|
||||
it "records a deprecation warning on the appropriate package if the item has a ::getUri method instead of ::getURI", ->
|
||||
jasmine.snapshotDeprecations()
|
||||
|
||||
waitsForPromise -> atom.packages.activatePackage('package-with-deprecated-pane-item-method')
|
||||
|
||||
waitsForPromise ->
|
||||
atom.workspace.open("test")
|
||||
|
||||
runs ->
|
||||
deprecations = Grim.getDeprecations()
|
||||
expect(deprecations.length).toBe 1
|
||||
expect(deprecations[0].message).toBe "Pane item with class `TestItem` should implement `::getURI` instead of `::getUri`."
|
||||
expect(deprecations[0].getStacks()[0].metadata.packageName).toBe "package-with-deprecated-pane-item-method"
|
||||
jasmine.restoreDeprecationsSnapshot()
|
||||
|
||||
describe "::reopenItem()", ->
|
||||
it "opens the uri associated with the last closed pane that isn't currently open", ->
|
||||
pane = workspace.getActivePane()
|
||||
@@ -261,21 +277,21 @@ describe "Workspace", ->
|
||||
|
||||
runs ->
|
||||
# does not reopen items with no uri
|
||||
expect(workspace.getActivePaneItem().getUri()).toBeUndefined()
|
||||
expect(workspace.getActivePaneItem().getURI()).toBeUndefined()
|
||||
pane.destroyActiveItem()
|
||||
|
||||
waitsForPromise ->
|
||||
workspace.reopenItem()
|
||||
|
||||
runs ->
|
||||
expect(workspace.getActivePaneItem().getUri()).not.toBeUndefined()
|
||||
expect(workspace.getActivePaneItem().getURI()).not.toBeUndefined()
|
||||
|
||||
# destroy all items
|
||||
expect(workspace.getActivePaneItem().getUri()).toBe atom.project.getDirectories()[0]?.resolve('file1')
|
||||
expect(workspace.getActivePaneItem().getURI()).toBe atom.project.getDirectories()[0]?.resolve('file1')
|
||||
pane.destroyActiveItem()
|
||||
expect(workspace.getActivePaneItem().getUri()).toBe atom.project.getDirectories()[0]?.resolve('b')
|
||||
expect(workspace.getActivePaneItem().getURI()).toBe atom.project.getDirectories()[0]?.resolve('b')
|
||||
pane.destroyActiveItem()
|
||||
expect(workspace.getActivePaneItem().getUri()).toBe atom.project.getDirectories()[0]?.resolve('a')
|
||||
expect(workspace.getActivePaneItem().getURI()).toBe atom.project.getDirectories()[0]?.resolve('a')
|
||||
pane.destroyActiveItem()
|
||||
|
||||
# reopens items with uris
|
||||
@@ -285,20 +301,20 @@ describe "Workspace", ->
|
||||
workspace.reopenItem()
|
||||
|
||||
runs ->
|
||||
expect(workspace.getActivePaneItem().getUri()).toBe atom.project.getDirectories()[0]?.resolve('a')
|
||||
expect(workspace.getActivePaneItem().getURI()).toBe atom.project.getDirectories()[0]?.resolve('a')
|
||||
|
||||
# does not reopen items that are already open
|
||||
waitsForPromise ->
|
||||
workspace.open('b')
|
||||
|
||||
runs ->
|
||||
expect(workspace.getActivePaneItem().getUri()).toBe atom.project.getDirectories()[0]?.resolve('b')
|
||||
expect(workspace.getActivePaneItem().getURI()).toBe atom.project.getDirectories()[0]?.resolve('b')
|
||||
|
||||
waitsForPromise ->
|
||||
workspace.reopenItem()
|
||||
|
||||
runs ->
|
||||
expect(workspace.getActivePaneItem().getUri()).toBe atom.project.getDirectories()[0]?.resolve('file1')
|
||||
expect(workspace.getActivePaneItem().getURI()).toBe atom.project.getDirectories()[0]?.resolve('file1')
|
||||
|
||||
describe "::increase/decreaseFontSize()", ->
|
||||
it "increases/decreases the font size without going below 1", ->
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
_ = require 'underscore-plus'
|
||||
ParsedColor = null
|
||||
|
||||
# Essential: A simple color class returned from {Config::get} when the value
|
||||
# at the key path is of type 'color'.
|
||||
module.exports =
|
||||
class Color
|
||||
# Essential: Parse a {String} or {Object} into a {Color}.
|
||||
#
|
||||
# * `value` A {String} such as `'white'`, `#ff00ff`, or
|
||||
# `'rgba(255, 15, 60, .75)'` or an {Object} with `red`, `green`, `blue`,
|
||||
# and `alpha` properties.
|
||||
#
|
||||
# Returns a {Color} or `null` if it cannot be parsed.
|
||||
@parse: (value) ->
|
||||
return null if _.isArray(value) or _.isFunction(value)
|
||||
return null unless _.isObject(value) or _.isString(value)
|
||||
|
||||
ParsedColor ?= require 'color'
|
||||
|
||||
try
|
||||
parsedColor = new ParsedColor(value)
|
||||
catch error
|
||||
return null
|
||||
|
||||
new Color(parsedColor.red(), parsedColor.green(), parsedColor.blue(), parsedColor.alpha())
|
||||
|
||||
constructor: (red, green, blue, alpha) ->
|
||||
Object.defineProperties this,
|
||||
red:
|
||||
set: (newRed) -> red = parseColor(newRed)
|
||||
get: -> red
|
||||
enumerable: true
|
||||
configurable: false
|
||||
green:
|
||||
set: (newGreen) -> green = parseColor(newGreen)
|
||||
get: -> green
|
||||
enumerable: true
|
||||
configurable: false
|
||||
blue:
|
||||
set: (newBlue) -> blue = parseColor(newBlue)
|
||||
get: -> blue
|
||||
enumerable: true
|
||||
configurable: false
|
||||
alpha:
|
||||
set: (newAlpha) -> alpha = parseAlpha(newAlpha)
|
||||
get: -> alpha
|
||||
enumerable: true
|
||||
configurable: false
|
||||
|
||||
@red = red
|
||||
@green = green
|
||||
@blue = blue
|
||||
@alpha = alpha
|
||||
|
||||
# Essential: Returns a {String} in the form `'#abcdef'`.
|
||||
toHexString: ->
|
||||
"##{numberToHexString(@red)}#{numberToHexString(@green)}#{numberToHexString(@blue)}"
|
||||
|
||||
# Essential: Returns a {String} in the form `'rgba(25, 50, 75, .9)'`.
|
||||
toRGBAString: ->
|
||||
"rgba(#{@red}, #{@green}, #{@blue}, #{@alpha})"
|
||||
|
||||
isEqual: (color) ->
|
||||
return true if this is color
|
||||
color = Color.parse(color) unless color instanceof Color
|
||||
return false unless color?
|
||||
color.red is @red and color.blue is @blue and color.green is @green and color.alpha is @alpha
|
||||
|
||||
clone: -> new Color(@red, @green, @blue, @alpha)
|
||||
|
||||
parseColor = (color) ->
|
||||
color = parseInt(color)
|
||||
color = 0 if isNaN(color)
|
||||
color = Math.max(color, 0)
|
||||
color = Math.min(color, 255)
|
||||
color
|
||||
|
||||
parseAlpha = (alpha) ->
|
||||
alpha = parseFloat(alpha)
|
||||
alpha = 1 if isNaN(alpha)
|
||||
alpha = Math.max(alpha, 0)
|
||||
alpha = Math.min(alpha, 1)
|
||||
alpha
|
||||
|
||||
numberToHexString = (number) ->
|
||||
hex = number.toString(16)
|
||||
hex = "0#{hex}" if number < 10
|
||||
hex
|
||||
+33
-4
@@ -8,6 +8,7 @@ async = require 'async'
|
||||
pathWatcher = require 'pathwatcher'
|
||||
Grim = require 'grim'
|
||||
|
||||
Color = require './color'
|
||||
ScopedPropertyStore = require 'scoped-property-store'
|
||||
ScopeDescriptor = require './scope-descriptor'
|
||||
|
||||
@@ -216,6 +217,21 @@ ScopeDescriptor = require './scope-descriptor'
|
||||
# maximum: 11.5
|
||||
# ```
|
||||
#
|
||||
# #### color
|
||||
#
|
||||
# Values will be coerced into a {Color} with `red`, `green`, `blue`, and `alpha`
|
||||
# properties that all have numeric values. `red`, `green`, `blue` will be in
|
||||
# the range 0 to 255 and `value` will be in the range 0 to 1. Values can be any
|
||||
# valid CSS color format such as `#abc`, `#abcdef`, `white`,
|
||||
# `rgb(50, 100, 150)`, and `rgba(25, 75, 125, .75)`.
|
||||
#
|
||||
# ```coffee
|
||||
# config:
|
||||
# someSetting:
|
||||
# type: 'color'
|
||||
# default: 'white'
|
||||
# ```
|
||||
#
|
||||
# ### Other Supported Keys
|
||||
#
|
||||
# #### enum
|
||||
@@ -687,7 +703,7 @@ class Config
|
||||
schema = @schema
|
||||
for key in keys
|
||||
break unless schema?
|
||||
schema = schema.properties[key]
|
||||
schema = schema.properties?[key]
|
||||
schema
|
||||
|
||||
# Deprecated: Returns a new {Object} containing all of the global settings and
|
||||
@@ -872,10 +888,16 @@ class Config
|
||||
defaultValue = _.valueForKeyPath(@defaultSettings, keyPath)
|
||||
|
||||
if value?
|
||||
value = _.deepClone(value)
|
||||
_.defaults(value, defaultValue) if isPlainObject(value) and isPlainObject(defaultValue)
|
||||
if value instanceof Color
|
||||
value = value.clone()
|
||||
else
|
||||
value = _.deepClone(value)
|
||||
_.defaults(value, defaultValue) if isPlainObject(value) and isPlainObject(defaultValue)
|
||||
else
|
||||
value = _.deepClone(defaultValue)
|
||||
if defaultValue instanceof Color
|
||||
value = defaultValue.clone()
|
||||
else
|
||||
value = _.deepClone(defaultValue)
|
||||
|
||||
value
|
||||
|
||||
@@ -1103,6 +1125,13 @@ Config.addSchemaEnforcers
|
||||
else
|
||||
value
|
||||
|
||||
'color':
|
||||
coerce: (keyPath, value, schema) ->
|
||||
color = Color.parse(value)
|
||||
unless color?
|
||||
throw new Error("Validation failed at #{keyPath}, #{JSON.stringify(value)} cannot be coerced into a color")
|
||||
color
|
||||
|
||||
'*':
|
||||
coerceMinimumAndMaximum: (keyPath, value, schema) ->
|
||||
return value unless typeof value is 'number'
|
||||
|
||||
@@ -232,7 +232,10 @@ class GitRepository
|
||||
#
|
||||
# * `path` (optional) {String} path in the repository to get this information
|
||||
# for, only needed if the repository has submodules.
|
||||
getOriginUrl: (path) -> @getConfigValue('remote.origin.url', path)
|
||||
getOriginURL: (path) -> @getConfigValue('remote.origin.url', path)
|
||||
getOriginUrl: (path) ->
|
||||
deprecate("Use ::getOriginURL instead.")
|
||||
@getOriginUrl()
|
||||
|
||||
# Public: Returns the upstream branch for the current HEAD, or null if there
|
||||
# is no upstream branch for the current HEAD.
|
||||
|
||||
@@ -23,12 +23,12 @@ LinesComponent = React.createClass
|
||||
if performedInitialMeasurement
|
||||
{editor, overlayDecorations, highlightDecorations, scrollHeight, scrollWidth, placeholderText, backgroundColor} = @props
|
||||
{lineHeightInPixels, defaultCharWidth, scrollViewHeight, scopedCharacterWidthsChangeCount} = @props
|
||||
{scrollTop, scrollLeft, cursorPixelRects, mini} = @props
|
||||
{scrollTop, scrollLeft, cursorPixelRects} = @props
|
||||
style =
|
||||
height: Math.max(scrollHeight, scrollViewHeight)
|
||||
width: scrollWidth
|
||||
WebkitTransform: @getTransform()
|
||||
backgroundColor: if mini then null else backgroundColor
|
||||
backgroundColor: if editor.isMini() then null else backgroundColor
|
||||
|
||||
div {className: 'lines', style},
|
||||
div className: 'placeholder-text', placeholderText if placeholderText?
|
||||
@@ -162,7 +162,7 @@ LinesComponent = React.createClass
|
||||
@lineNodesByLineId.hasOwnProperty(lineId)
|
||||
|
||||
buildLineHTML: (line, screenRow) ->
|
||||
{mini, showIndentGuide, lineHeightInPixels, lineDecorations, lineWidth} = @props
|
||||
{showIndentGuide, lineHeightInPixels, lineDecorations, lineWidth} = @props
|
||||
{tokens, text, lineEnding, fold, isSoftWrapped, indentLevel} = line
|
||||
|
||||
classes = ''
|
||||
@@ -208,7 +208,7 @@ LinesComponent = React.createClass
|
||||
@buildEndOfLineHTML(line) or ' '
|
||||
|
||||
buildLineInnerHTML: (line) ->
|
||||
{mini, showIndentGuide} = @props
|
||||
{editor, showIndentGuide} = @props
|
||||
{tokens, text} = line
|
||||
innerHTML = ""
|
||||
|
||||
@@ -217,7 +217,7 @@ LinesComponent = React.createClass
|
||||
lineIsWhitespaceOnly = firstTrailingWhitespacePosition is 0
|
||||
for token in tokens
|
||||
innerHTML += @updateScopeStack(scopeStack, token.scopes)
|
||||
hasIndentGuide = not mini and showIndentGuide and (token.hasLeadingWhitespace() or (token.hasTrailingWhitespace() and lineIsWhitespaceOnly))
|
||||
hasIndentGuide = not editor.isMini() and showIndentGuide and (token.hasLeadingWhitespace() or (token.hasTrailingWhitespace() and lineIsWhitespaceOnly))
|
||||
innerHTML += token.getValueAsHtml({hasIndentGuide})
|
||||
|
||||
innerHTML += @popScope(scopeStack) while scopeStack.length > 0
|
||||
|
||||
+4
-4
@@ -268,7 +268,7 @@ class Marker
|
||||
|
||||
# Extended: Sets the buffer position of the marker's head.
|
||||
#
|
||||
# * `screenRange` The new {Point} to use
|
||||
# * `bufferPosition` The new {Point} to use
|
||||
# * `properties` (optional) {Object} properties to associate with the marker.
|
||||
setHeadBufferPosition: (bufferPosition, properties) ->
|
||||
@bufferMarker.setHeadPosition(bufferPosition, properties)
|
||||
@@ -281,7 +281,7 @@ class Marker
|
||||
|
||||
# Extended: Sets the screen position of the marker's head.
|
||||
#
|
||||
# * `screenRange` The new {Point} to use
|
||||
# * `screenPosition` The new {Point} to use
|
||||
# * `properties` (optional) {Object} properties to associate with the marker.
|
||||
setHeadScreenPosition: (screenPosition, properties) ->
|
||||
screenPosition = @displayBuffer.clipScreenPosition(screenPosition, properties)
|
||||
@@ -295,7 +295,7 @@ class Marker
|
||||
|
||||
# Extended: Sets the buffer position of the marker's tail.
|
||||
#
|
||||
# * `screenRange` The new {Point} to use
|
||||
# * `bufferPosition` The new {Point} to use
|
||||
# * `properties` (optional) {Object} properties to associate with the marker.
|
||||
setTailBufferPosition: (bufferPosition) ->
|
||||
@bufferMarker.setTailPosition(bufferPosition)
|
||||
@@ -308,7 +308,7 @@ class Marker
|
||||
|
||||
# Extended: Sets the screen position of the marker's tail.
|
||||
#
|
||||
# * `screenRange` The new {Point} to use
|
||||
# * `screenPosition` The new {Point} to use
|
||||
# * `properties` (optional) {Object} properties to associate with the marker.
|
||||
setTailScreenPosition: (screenPosition, options) ->
|
||||
screenPosition = @displayBuffer.clipScreenPosition(screenPosition, options)
|
||||
|
||||
@@ -64,7 +64,7 @@ class PaneContainerView extends View
|
||||
@getActivePaneView()?.activeView
|
||||
|
||||
paneForUri: (uri) ->
|
||||
atom.views.getView(@model.paneForUri(uri)).__spacePenView
|
||||
atom.views.getView(@model.paneForURI(uri)).__spacePenView
|
||||
|
||||
focusNextPaneView: ->
|
||||
@model.activateNextPane()
|
||||
|
||||
@@ -143,8 +143,8 @@ class PaneContainer extends Model
|
||||
getActivePaneItem: ->
|
||||
@getActivePane().getActiveItem()
|
||||
|
||||
paneForUri: (uri) ->
|
||||
find @getPanes(), (pane) -> pane.itemForUri(uri)?
|
||||
paneForURI: (uri) ->
|
||||
find @getPanes(), (pane) -> pane.itemForURI(uri)?
|
||||
|
||||
paneForItem: (item) ->
|
||||
@getPanes().find (pane) -> item in pane.getItems()
|
||||
|
||||
+47
-9
@@ -41,16 +41,28 @@ class Pane extends Model
|
||||
|
||||
# Called by the Serializable mixin during serialization.
|
||||
serializeParams: ->
|
||||
if typeof @activeItem?.getURI is 'function'
|
||||
activeItemURI = @activeItem.getURI()
|
||||
else if typeof @activeItem?.getUri is 'function'
|
||||
activeItemURI = @activeItem.getUri()
|
||||
|
||||
id: @id
|
||||
items: compact(@items.map((item) -> item.serialize?()))
|
||||
activeItemUri: @activeItem?.getUri?()
|
||||
activeItemURI: activeItemURI
|
||||
focused: @focused
|
||||
|
||||
# Called by the Serializable mixin during deserialization.
|
||||
deserializeParams: (params) ->
|
||||
{items, activeItemUri} = params
|
||||
{items, activeItemURI, activeItemUri} = params
|
||||
activeItemURI ?= activeItemUri
|
||||
params.items = compact(items.map (itemState) -> atom.deserializers.deserialize(itemState))
|
||||
params.activeItem = find params.items, (item) -> item.getUri?() is activeItemUri
|
||||
params.activeItem = find params.items, (item) ->
|
||||
if typeof item.getURI is 'function'
|
||||
itemURI = item.getURI()
|
||||
else if typeof item.getUri is 'function'
|
||||
itemURI = item.getUri()
|
||||
|
||||
itemURI is activeItemURI
|
||||
params
|
||||
|
||||
getParent: -> @parent
|
||||
@@ -426,10 +438,17 @@ class Pane extends Model
|
||||
@destroyItem(item) for item in @getItems() when item isnt @activeItem
|
||||
|
||||
promptToSaveItem: (item) ->
|
||||
return true unless typeof item.getUri is 'function' and item.shouldPromptToSave?()
|
||||
return true unless item.shouldPromptToSave?()
|
||||
|
||||
if typeof item.getURI is 'function'
|
||||
uri = item.getURI()
|
||||
else if typeof item.getUri is 'function'
|
||||
uri = item.getUri()
|
||||
else
|
||||
return true
|
||||
|
||||
chosen = atom.confirm
|
||||
message: "'#{item.getTitle?() ? item.getUri()}' has changes, do you want to save them?"
|
||||
message: "'#{item.getTitle?() ? uri}' has changes, do you want to save them?"
|
||||
detailedMessage: "Your changes will be lost if you close this item without saving."
|
||||
buttons: ["Save", "Cancel", "Don't Save"]
|
||||
|
||||
@@ -456,7 +475,12 @@ class Pane extends Model
|
||||
# * `nextAction` (optional) {Function} which will be called after the item is
|
||||
# successfully saved.
|
||||
saveItem: (item, nextAction) ->
|
||||
if item?.getUri?()
|
||||
if typeof item?.getURI is 'function'
|
||||
itemURI = item.getURI()
|
||||
else if typeof item?.getUri is 'function'
|
||||
itemURI = item.getUri()
|
||||
|
||||
if itemURI?
|
||||
item.save?()
|
||||
nextAction?()
|
||||
else
|
||||
@@ -485,19 +509,33 @@ class Pane extends Model
|
||||
# none exists.
|
||||
#
|
||||
# * `uri` {String} containing a URI.
|
||||
itemForURI: (uri) ->
|
||||
find @items, (item) ->
|
||||
if typeof item.getURI is 'function'
|
||||
itemUri = item.getURI()
|
||||
else if typeof item.getUri is 'function'
|
||||
itemUri = item.getUri()
|
||||
|
||||
itemUri is uri
|
||||
|
||||
itemForUri: (uri) ->
|
||||
find @items, (item) -> item.getUri?() is uri
|
||||
Grim.deprecate("Use `::itemForURI` instead.")
|
||||
@itemForURI(uri)
|
||||
|
||||
# Public: Activate the first item that matches the given URI.
|
||||
#
|
||||
# Returns a {Boolean} indicating whether an item matching the URI was found.
|
||||
activateItemForUri: (uri) ->
|
||||
if item = @itemForUri(uri)
|
||||
activateItemForURI: (uri) ->
|
||||
if item = @itemForURI(uri)
|
||||
@activateItem(item)
|
||||
true
|
||||
else
|
||||
false
|
||||
|
||||
activateItemForUri: (uri) ->
|
||||
Grim.deprecate("Use `::activateItemForURI` instead.")
|
||||
@activateItemForURI(uri)
|
||||
|
||||
copyActiveItem: ->
|
||||
if @activeItem?
|
||||
@activeItem.copy?() ? atom.deserializers.deserialize(@activeItem.serialize())
|
||||
|
||||
@@ -48,7 +48,7 @@ TextEditorComponent = React.createClass
|
||||
|
||||
render: ->
|
||||
{focused, showIndentGuide, showLineNumbers, visible} = @state
|
||||
{editor, mini, cursorBlinkPeriod, cursorBlinkResumeDelay, hostElement, useShadowDOM} = @props
|
||||
{editor, cursorBlinkPeriod, cursorBlinkResumeDelay, hostElement, useShadowDOM} = @props
|
||||
maxLineNumberDigits = editor.getLineCount().toString().length
|
||||
hasSelection = editor.getLastSelection()? and !editor.getLastSelection().isEmpty()
|
||||
style = {}
|
||||
@@ -96,7 +96,7 @@ TextEditorComponent = React.createClass
|
||||
className += ' has-selection' if hasSelection
|
||||
|
||||
div {className, style},
|
||||
if @shouldRenderGutter()
|
||||
if @gutterVisible
|
||||
GutterComponent {
|
||||
ref: 'gutter', onMouseDown: @onGutterMouseDown, lineDecorations,
|
||||
defaultCharWidth, editor, renderedRowRange, maxLineNumberDigits, scrollViewHeight,
|
||||
@@ -118,7 +118,7 @@ TextEditorComponent = React.createClass
|
||||
@scrollingVertically, scrollHeight, scrollWidth, mouseWheelScreenRow,
|
||||
visible, scrollViewHeight, @scopedCharacterWidthsChangeCount, lineWidth, @useHardwareAcceleration,
|
||||
placeholderText, @performedInitialMeasurement, @backgroundColor, cursorPixelRects,
|
||||
cursorBlinkPeriod, cursorBlinkResumeDelay, mini, useShadowDOM
|
||||
cursorBlinkPeriod, cursorBlinkResumeDelay, useShadowDOM
|
||||
}
|
||||
|
||||
ScrollbarComponent
|
||||
@@ -159,9 +159,6 @@ TextEditorComponent = React.createClass
|
||||
{editor} = @props
|
||||
Math.max(1, Math.ceil(editor.getHeight() / editor.getLineHeightInPixels()))
|
||||
|
||||
shouldRenderGutter: ->
|
||||
not @props.mini and @state.showLineNumbers
|
||||
|
||||
getInitialState: -> {}
|
||||
|
||||
getDefaultProps: ->
|
||||
@@ -190,7 +187,7 @@ TextEditorComponent = React.createClass
|
||||
|
||||
@domPollingIntervalId = setInterval(@pollDOM, @domPollingInterval)
|
||||
@updateParentViewFocusedClassIfNeeded({})
|
||||
@updateParentViewMiniClassIfNeeded({})
|
||||
@updateParentViewMiniClass()
|
||||
@checkForVisibilityChange()
|
||||
|
||||
componentWillUnmount: ->
|
||||
@@ -202,9 +199,6 @@ TextEditorComponent = React.createClass
|
||||
clearInterval(@domPollingIntervalId)
|
||||
@domPollingIntervalId = null
|
||||
|
||||
componentWillReceiveProps: (newProps) ->
|
||||
@props.editor.setMini(newProps.mini)
|
||||
|
||||
componentDidUpdate: (prevProps, prevState) ->
|
||||
cursorMoved = @cursorMoved
|
||||
selectionChanged = @selectionChanged
|
||||
@@ -214,7 +208,7 @@ TextEditorComponent = React.createClass
|
||||
|
||||
if @props.editor.isAlive()
|
||||
@updateParentViewFocusedClassIfNeeded(prevState)
|
||||
@updateParentViewMiniClassIfNeeded(prevState)
|
||||
@updateParentViewMiniClass()
|
||||
@props.hostElement.__spacePenView.trigger 'cursor:moved' if cursorMoved
|
||||
@props.hostElement.__spacePenView.trigger 'selection:changed' if selectionChanged
|
||||
@props.hostElement.__spacePenView.trigger 'editor:display-updated'
|
||||
@@ -308,8 +302,8 @@ TextEditorComponent = React.createClass
|
||||
cursorPixelRects
|
||||
|
||||
getLineDecorations: (decorationsByMarkerId) ->
|
||||
{editor, mini} = @props
|
||||
return {} if mini
|
||||
{editor} = @props
|
||||
return {} if editor.isMini()
|
||||
|
||||
decorationsByScreenRow = {}
|
||||
for markerId, decorations of decorationsByMarkerId
|
||||
@@ -377,6 +371,8 @@ TextEditorComponent = React.createClass
|
||||
observeEditor: ->
|
||||
{editor} = @props
|
||||
@subscribe editor.onDidChange(@onScreenLinesChanged)
|
||||
@subscribe editor.onDidChangeGutterVisible(@updateGutterVisible)
|
||||
@subscribe editor.onDidChangeMini(@setMini)
|
||||
@subscribe editor.observeGrammar(@onGrammarChanged)
|
||||
@subscribe editor.observeCursors(@onCursorAdded)
|
||||
@subscribe editor.observeSelections(@onSelectionAdded)
|
||||
@@ -463,7 +459,7 @@ TextEditorComponent = React.createClass
|
||||
scopeDescriptor = editor.getRootScopeDescriptor()
|
||||
|
||||
subscriptions.add atom.config.observe 'editor.showIndentGuide', scope: scopeDescriptor, @setShowIndentGuide
|
||||
subscriptions.add atom.config.observe 'editor.showLineNumbers', scope: scopeDescriptor, @setShowLineNumbers
|
||||
subscriptions.add atom.config.observe 'editor.showLineNumbers', scope: scopeDescriptor, @updateGutterVisible
|
||||
subscriptions.add atom.config.observe 'editor.scrollSensitivity', scope: scopeDescriptor, @setScrollSensitivity
|
||||
|
||||
focused: ->
|
||||
@@ -881,7 +877,7 @@ TextEditorComponent = React.createClass
|
||||
@backgroundColor = backgroundColor
|
||||
@requestUpdate() unless suppressUpdate
|
||||
|
||||
if @shouldRenderGutter()
|
||||
if @refs.gutter?
|
||||
gutterBackgroundColor = getComputedStyle(@refs.gutter.getDOMNode()).backgroundColor
|
||||
if gutterBackgroundColor isnt @gutterBackgroundColor
|
||||
@gutterBackgroundColor = gutterBackgroundColor
|
||||
@@ -1001,6 +997,16 @@ TextEditorComponent = React.createClass
|
||||
setShowIndentGuide: (showIndentGuide) ->
|
||||
@setState({showIndentGuide})
|
||||
|
||||
setMini: ->
|
||||
@updateGutterVisible()
|
||||
@requestUpdate()
|
||||
|
||||
updateGutterVisible: ->
|
||||
gutterVisible = not @props.editor.isMini() and @props.editor.isGutterVisible() and atom.config.get('editor.showLineNumbers')
|
||||
if gutterVisible isnt @gutterVisible
|
||||
@gutterVisible = gutterVisible
|
||||
@requestUpdate()
|
||||
|
||||
# Deprecated
|
||||
setInvisibles: (invisibles={}) ->
|
||||
grim.deprecate "Use config.set('editor.invisibles', invisibles) instead"
|
||||
@@ -1010,9 +1016,6 @@ TextEditorComponent = React.createClass
|
||||
setShowInvisibles: (showInvisibles) ->
|
||||
atom.config.set('editor.showInvisibles', showInvisibles)
|
||||
|
||||
setShowLineNumbers: (showLineNumbers) ->
|
||||
@setState({showLineNumbers})
|
||||
|
||||
setScrollSensitivity: (scrollSensitivity) ->
|
||||
if scrollSensitivity = parseInt(scrollSensitivity)
|
||||
@scrollSensitivity = Math.abs(scrollSensitivity) / 100
|
||||
@@ -1047,10 +1050,9 @@ TextEditorComponent = React.createClass
|
||||
@props.hostElement.classList.toggle('is-focused', @state.focused)
|
||||
@props.rootElement.classList.toggle('is-focused', @state.focused)
|
||||
|
||||
updateParentViewMiniClassIfNeeded: (prevProps) ->
|
||||
if prevProps.mini isnt @props.mini
|
||||
@props.hostElement.classList.toggle('mini', @props.mini)
|
||||
@props.rootElement.classList.toggle('mini', @props.mini)
|
||||
updateParentViewMiniClass: ->
|
||||
@props.hostElement.classList.toggle('mini', @props.editor.isMini())
|
||||
@props.rootElement.classList.toggle('mini', @props.editor.isMini())
|
||||
|
||||
runScrollBenchmark: ->
|
||||
unless process.env.NODE_ENV is 'production'
|
||||
|
||||
@@ -100,6 +100,7 @@ class TextEditorElement extends HTMLElement
|
||||
tabLength: 2
|
||||
softTabs: true
|
||||
mini: @hasAttribute('mini')
|
||||
gutterVisible: not @hasAttribute('gutter-hidden')
|
||||
placeholderText: @getAttribute('placeholder-text')
|
||||
))
|
||||
|
||||
@@ -109,7 +110,6 @@ class TextEditorElement extends HTMLElement
|
||||
rootElement: @rootElement
|
||||
stylesElement: @stylesElement
|
||||
editor: @model
|
||||
mini: @model.mini
|
||||
lineOverdrawMargin: @lineOverdrawMargin
|
||||
useShadowDOM: @useShadowDOM
|
||||
)
|
||||
|
||||
@@ -127,7 +127,7 @@ class TextEditorView extends View
|
||||
Object.defineProperty @::, 'lastRenderedScreenRow', get: -> @component.getRenderedRowRange()[1]
|
||||
Object.defineProperty @::, 'active', get: -> @is(@getPaneView()?.activeView)
|
||||
Object.defineProperty @::, 'isFocused', get: -> document.activeElement is @element or document.activeElement is @element.component?.refs.input.getDOMNode()
|
||||
Object.defineProperty @::, 'mini', get: -> @component?.props.mini
|
||||
Object.defineProperty @::, 'mini', get: -> @model?.isMini()
|
||||
Object.defineProperty @::, 'component', get: -> @element?.component
|
||||
|
||||
afterAttach: (onDom) ->
|
||||
|
||||
@@ -77,7 +77,7 @@ class TextEditor extends Model
|
||||
'$verticalScrollbarWidth', '$horizontalScrollbarHeight', '$scrollTop', '$scrollLeft',
|
||||
'manageScrollPosition', toProperty: 'displayBuffer'
|
||||
|
||||
constructor: ({@softTabs, initialLine, initialColumn, tabLength, softWrapped, @displayBuffer, buffer, registerEditor, suppressCursorCreation, @mini, @placeholderText}) ->
|
||||
constructor: ({@softTabs, initialLine, initialColumn, tabLength, softWrapped, @displayBuffer, buffer, registerEditor, suppressCursorCreation, @mini, @placeholderText, @gutterVisible}) ->
|
||||
super
|
||||
|
||||
@emitter = new Emitter
|
||||
@@ -354,7 +354,7 @@ class TextEditor extends Model
|
||||
# Immediately calls your callback for each existing cursor.
|
||||
#
|
||||
# * `callback` {Function}
|
||||
# * `selection` {Selection} that was added
|
||||
# * `cursor` {Cursor} that was added
|
||||
#
|
||||
# Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.
|
||||
observeCursors: (callback) ->
|
||||
@@ -515,7 +515,11 @@ class TextEditor extends Model
|
||||
getBuffer: -> @buffer
|
||||
|
||||
# Retrieves the current buffer's URI.
|
||||
getUri: -> @buffer.getUri()
|
||||
getURI: -> @buffer.getUri()
|
||||
|
||||
getUri: ->
|
||||
deprecate("Use `::getURI` instead")
|
||||
@getURI()
|
||||
|
||||
# Create an {TextEditor} with its initial state based on this object
|
||||
copy: ->
|
||||
@@ -533,9 +537,25 @@ class TextEditor extends Model
|
||||
if mini isnt @mini
|
||||
@mini = mini
|
||||
@updateInvisibles()
|
||||
@emitter.emit 'did-change-mini', @mini
|
||||
@mini
|
||||
|
||||
isMini: -> @mini
|
||||
|
||||
onDidChangeMini: (callback) ->
|
||||
@emitter.on 'did-change-mini', callback
|
||||
|
||||
setGutterVisible: (gutterVisible) ->
|
||||
unless gutterVisible is @gutterVisible
|
||||
@gutterVisible = gutterVisible
|
||||
@emitter.emit 'did-change-gutter-visible', @gutterVisible
|
||||
@gutterVisible
|
||||
|
||||
isGutterVisible: -> @gutterVisible ? true
|
||||
|
||||
onDidChangeGutterVisible: (callback) ->
|
||||
@emitter.on 'did-change-gutter-visible', callback
|
||||
|
||||
# Set the number of characters that can be displayed horizontally in the
|
||||
# editor.
|
||||
#
|
||||
|
||||
@@ -96,6 +96,9 @@ class WindowEventHandler
|
||||
|
||||
@subscribe $(document), 'click', 'a', @openLink
|
||||
|
||||
# Prevent form submits from changing the current window's URL
|
||||
@subscribe $(document), 'submit', 'form', (e) -> e.preventDefault()
|
||||
|
||||
@subscribe $(document), 'contextmenu', (e) ->
|
||||
e.preventDefault()
|
||||
atom.contextMenu.showForEvent(e)
|
||||
|
||||
@@ -52,7 +52,7 @@ module.exports =
|
||||
class WorkspaceView extends View
|
||||
Delegator.includeInto(this)
|
||||
|
||||
@delegatesProperty 'fullScreen', 'destroyedItemUris', toProperty: 'model'
|
||||
@delegatesProperty 'fullScreen', 'destroyedItemURIs', toProperty: 'model'
|
||||
@delegatesMethods 'open', 'openSync',
|
||||
'saveActivePaneItem', 'saveActivePaneItemAs', 'saveAll', 'destroyActivePaneItem',
|
||||
'destroyActivePane', 'increaseFontSize', 'decreaseFontSize', toProperty: 'model'
|
||||
|
||||
+70
-17
@@ -1,12 +1,14 @@
|
||||
{deprecate} = require 'grim'
|
||||
_ = require 'underscore-plus'
|
||||
{join} = require 'path'
|
||||
path = require 'path'
|
||||
{join} = path
|
||||
{Model} = require 'theorist'
|
||||
Q = require 'q'
|
||||
Serializable = require 'serializable'
|
||||
{Emitter, Disposable, CompositeDisposable} = require 'event-kit'
|
||||
Grim = require 'grim'
|
||||
fs = require 'fs-plus'
|
||||
StackTraceParser = require 'stacktrace-parser'
|
||||
TextEditor = require './text-editor'
|
||||
PaneContainer = require './pane-container'
|
||||
Pane = require './pane'
|
||||
@@ -44,7 +46,7 @@ class Workspace extends Model
|
||||
@properties
|
||||
paneContainer: null
|
||||
fullScreen: false
|
||||
destroyedItemUris: -> []
|
||||
destroyedItemURIs: -> []
|
||||
|
||||
constructor: (params) ->
|
||||
super
|
||||
@@ -385,7 +387,7 @@ class Workspace extends Model
|
||||
split = options.split
|
||||
uri = atom.project.resolvePath(uri)
|
||||
|
||||
pane = @paneContainer.paneForUri(uri) if searchAllPanes
|
||||
pane = @paneContainer.paneForURI(uri) if searchAllPanes
|
||||
pane ?= switch split
|
||||
when 'left'
|
||||
@getActivePane().findLeftmostSibling()
|
||||
@@ -394,7 +396,7 @@ class Workspace extends Model
|
||||
else
|
||||
@getActivePane()
|
||||
|
||||
@openUriInPane(uri, pane, options)
|
||||
@openURIInPane(uri, pane, options)
|
||||
|
||||
# Open Atom's license in the active pane.
|
||||
openLicense: ->
|
||||
@@ -423,7 +425,7 @@ class Workspace extends Model
|
||||
activatePane = options.activatePane ? true
|
||||
|
||||
uri = atom.project.resolvePath(uri)
|
||||
item = @getActivePane().itemForUri(uri)
|
||||
item = @getActivePane().itemForURI(uri)
|
||||
if uri
|
||||
item ?= opener(uri, options) for opener in @getOpeners() when !item
|
||||
item ?= atom.project.openSync(uri, {initialLine, initialColumn})
|
||||
@@ -433,7 +435,7 @@ class Workspace extends Model
|
||||
@getActivePane().activate() if activatePane
|
||||
item
|
||||
|
||||
openUriInPane: (uri, pane, options={}) ->
|
||||
openURIInPane: (uri, pane, options={}) ->
|
||||
# TODO: Remove deprecated changeFocus option
|
||||
if options.changeFocus?
|
||||
deprecate("The `changeFocus` option has been renamed to `activatePane`")
|
||||
@@ -443,7 +445,7 @@ class Workspace extends Model
|
||||
activatePane = options.activatePane ? true
|
||||
|
||||
if uri?
|
||||
item = pane.itemForUri(uri)
|
||||
item = pane.itemForURI(uri)
|
||||
item ?= opener(uri, options) for opener in @getOpeners() when !item
|
||||
item ?= atom.project.open(uri, options)
|
||||
|
||||
@@ -467,7 +469,7 @@ class Workspace extends Model
|
||||
#
|
||||
# Returns a promise that is resolved when the item is opened
|
||||
reopenItem: ->
|
||||
if uri = @destroyedItemUris.pop()
|
||||
if uri = @destroyedItemURIs.pop()
|
||||
@open(uri)
|
||||
else
|
||||
Q()
|
||||
@@ -475,7 +477,7 @@ class Workspace extends Model
|
||||
# Deprecated
|
||||
reopenItemSync: ->
|
||||
deprecate("Use Workspace::reopenItem instead")
|
||||
if uri = @destroyedItemUris.pop()
|
||||
if uri = @destroyedItemURIs.pop()
|
||||
@openSync(uri)
|
||||
|
||||
# Public: Register an opener for a uri.
|
||||
@@ -495,8 +497,17 @@ class Workspace extends Model
|
||||
# Returns a {Disposable} on which `.dispose()` can be called to remove the
|
||||
# opener.
|
||||
addOpener: (opener) ->
|
||||
@openers.push(opener)
|
||||
new Disposable => _.remove(@openers, opener)
|
||||
packageName = @getCallingPackageName()
|
||||
|
||||
wrappedOpener = (uri, options) ->
|
||||
item = opener(uri, options)
|
||||
if item? and typeof item.getUri is 'function' and typeof item.getURI isnt 'function'
|
||||
Grim.deprecate("Pane item with class `#{item.constructor.name}` should implement `::getURI` instead of `::getUri`.", {packageName})
|
||||
item
|
||||
|
||||
@openers.push(wrappedOpener)
|
||||
new Disposable => _.remove(@openers, wrappedOpener)
|
||||
|
||||
registerOpener: (opener) ->
|
||||
Grim.deprecate("Call Workspace::addOpener instead")
|
||||
@addOpener(opener)
|
||||
@@ -508,6 +519,34 @@ class Workspace extends Model
|
||||
getOpeners: ->
|
||||
@openers
|
||||
|
||||
getCallingPackageName: ->
|
||||
error = new Error
|
||||
Error.captureStackTrace(error)
|
||||
stack = StackTraceParser.parse(error.stack)
|
||||
|
||||
packagePaths = @getPackagePathsByPackageName()
|
||||
|
||||
for i in [0...stack.length]
|
||||
stackFramePath = stack[i].file
|
||||
|
||||
# Empty when it was run from the dev console
|
||||
return unless stackFramePath
|
||||
|
||||
for packageName, packagePath of packagePaths
|
||||
continue if stackFramePath is 'node.js'
|
||||
relativePath = path.relative(packagePath, stackFramePath)
|
||||
return packageName unless /^\.\./.test(relativePath)
|
||||
return
|
||||
|
||||
getPackagePathsByPackageName: ->
|
||||
packagePathsByPackageName = {}
|
||||
for pack in atom.packages.getLoadedPackages()
|
||||
packagePath = pack.path
|
||||
if packagePath.indexOf('.atom/dev/packages') > -1 or packagePath.indexOf('.atom/packages') > -1
|
||||
packagePath = fs.realpathSync(packagePath)
|
||||
packagePathsByPackageName[pack.name] = packagePath
|
||||
packagePathsByPackageName
|
||||
|
||||
###
|
||||
Section: Pane Items
|
||||
###
|
||||
@@ -553,7 +592,7 @@ class Workspace extends Model
|
||||
# Save the active pane item.
|
||||
#
|
||||
# If the active pane item currently has a URI according to the item's
|
||||
# `.getUri` method, calls `.save` on the item. Otherwise
|
||||
# `.getURI` method, calls `.save` on the item. Otherwise
|
||||
# {::saveActivePaneItemAs} # will be called instead. This method does nothing
|
||||
# if the active item does not implement a `.save` method.
|
||||
saveActivePaneItem: ->
|
||||
@@ -617,8 +656,12 @@ class Workspace extends Model
|
||||
# * `uri` {String} uri
|
||||
#
|
||||
# Returns a {Pane} or `undefined` if no pane exists for the given URI.
|
||||
paneForURI: (uri) ->
|
||||
@paneContainer.paneForURI(uri)
|
||||
|
||||
paneForUri: (uri) ->
|
||||
@paneContainer.paneForUri(uri)
|
||||
deprecate("Use ::paneForURI instead.")
|
||||
@paneForURI(uri)
|
||||
|
||||
# Extended: Get the {Pane} containing the given item.
|
||||
#
|
||||
@@ -651,13 +694,23 @@ class Workspace extends Model
|
||||
|
||||
# Removes the item's uri from the list of potential items to reopen.
|
||||
itemOpened: (item) ->
|
||||
if uri = item.getUri?()
|
||||
_.remove(@destroyedItemUris, uri)
|
||||
if typeof item.getURI is 'function'
|
||||
uri = item.getURI()
|
||||
else if typeof item.getUri is 'function'
|
||||
uri = item.getUri()
|
||||
|
||||
if uri?
|
||||
_.remove(@destroyedItemURIs, uri)
|
||||
|
||||
# Adds the destroyed item's uri to the list of items to reopen.
|
||||
didDestroyPaneItem: ({item}) =>
|
||||
if uri = item.getUri?()
|
||||
@destroyedItemUris.push(uri)
|
||||
if typeof item.getURI is 'function'
|
||||
uri = item.getURI()
|
||||
else if typeof item.getUri is 'function'
|
||||
uri = item.getUri()
|
||||
|
||||
if uri?
|
||||
@destroyedItemURIs.push(uri)
|
||||
|
||||
# Called by Model superclass when destroyed
|
||||
destroyed: ->
|
||||
|
||||
externo
+9
@@ -12,3 +12,12 @@
|
||||
background-color: @background-color-selected;
|
||||
}
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-family: inherit; // inherit from themes
|
||||
}
|
||||
|
||||
+8
-1
@@ -23,7 +23,14 @@ window.onload = function() {
|
||||
};
|
||||
|
||||
// Skip "?loadSettings=".
|
||||
var loadSettings = JSON.parse(decodeURIComponent(location.search.substr(14)));
|
||||
var rawLoadSettings = decodeURIComponent(location.search.substr(14));
|
||||
var loadSettings;
|
||||
try {
|
||||
loadSettings = JSON.parse(rawLoadSettings);
|
||||
} catch (error) {
|
||||
console.error("Failed to parse load settings: " + rawLoadSettings);
|
||||
throw error;
|
||||
}
|
||||
|
||||
// Normalize to make sure drive letter case is consistent on Windows
|
||||
process.resourcesPath = path.normalize(process.resourcesPath);
|
||||
|
||||
@@ -12,15 +12,6 @@ body {
|
||||
font-size: @font-size;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-family: @font-family;
|
||||
}
|
||||
|
||||
atom-workspace {
|
||||
display: block;
|
||||
height: 100%;
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário