Comparar commits
22 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 |
+1
-1
@@ -6,6 +6,6 @@
|
||||
"url": "https://github.com/atom/atom.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"atom-package-manager": "0.119.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,14 +12,14 @@
|
||||
"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.12.0",
|
||||
"grunt-contrib-csslint": "~0.1.2",
|
||||
"grunt-contrib-less": "~0.8.0",
|
||||
"grunt-cson": "0.14.0",
|
||||
"grunt-download-atom-shell": "~0.10.0",
|
||||
"grunt-download-atom-shell": "~0.11.0",
|
||||
"grunt-lesslint": "0.13.0",
|
||||
"grunt-peg": "~1.1.0",
|
||||
"grunt-shell": "~0.3.1",
|
||||
|
||||
+5
-4
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "atom",
|
||||
"productName": "Atom",
|
||||
"version": "0.171.0",
|
||||
"version": "0.173.0",
|
||||
"description": "A hackable text editor for the 21st Century.",
|
||||
"main": "./src/browser/main.js",
|
||||
"repository": {
|
||||
@@ -56,11 +56,12 @@
|
||||
"scandal": "1.0.3",
|
||||
"scoped-property-store": "^0.16.2",
|
||||
"scrollbar-style": "^1.0.2",
|
||||
"season": "^5.0.4",
|
||||
"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",
|
||||
@@ -84,7 +85,7 @@
|
||||
"bookmarks": "0.33.0",
|
||||
"bracket-matcher": "0.67.0",
|
||||
"command-palette": "0.32.0",
|
||||
"deprecation-cop": "0.26.0",
|
||||
"deprecation-cop": "0.28.0",
|
||||
"dev-live-reload": "0.36.0",
|
||||
"encoding-selector": "0.14.0",
|
||||
"exception-reporting": "0.21.0",
|
||||
@@ -106,7 +107,7 @@
|
||||
"settings-view": "0.172.0",
|
||||
"snippets": "0.67.0",
|
||||
"spell-check": "0.49.0",
|
||||
"status-bar": "0.56.0",
|
||||
"status-bar": "0.57.0",
|
||||
"styleguide": "0.41.0",
|
||||
"symbols-view": "0.77.0",
|
||||
"tabs": "0.62.0",
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class TestItem
|
||||
getUri: -> "test"
|
||||
|
||||
exports.activate = ->
|
||||
atom.workspace.addOpener -> new TestItem
|
||||
@@ -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
|
||||
@@ -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()
|
||||
|
||||
+8
-6
@@ -1,5 +1,5 @@
|
||||
_ = require 'underscore-plus'
|
||||
ParsedColor = require 'color'
|
||||
ParsedColor = null
|
||||
|
||||
# Essential: A simple color class returned from {Config::get} when the value
|
||||
# at the key path is of type 'color'.
|
||||
@@ -7,15 +7,17 @@ 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.
|
||||
# * `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
|
||||
@@ -51,11 +53,11 @@ class Color
|
||||
@blue = blue
|
||||
@alpha = alpha
|
||||
|
||||
# Esssential: Returns a {String} in the form `'#abcdef'`.
|
||||
# Essential: Returns a {String} in the form `'#abcdef'`.
|
||||
toHexString: ->
|
||||
"##{numberToHexString(@red)}#{numberToHexString(@green)}#{numberToHexString(@blue)}"
|
||||
|
||||
# Esssential: Returns a {String} in the form `'rgba(25, 50, 75, .9)'`.
|
||||
# Essential: Returns a {String} in the form `'rgba(25, 50, 75, .9)'`.
|
||||
toRGBAString: ->
|
||||
"rgba(#{@red}, #{@green}, #{@blue}, #{@alpha})"
|
||||
|
||||
|
||||
+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)
|
||||
|
||||
+34
-8
@@ -41,9 +41,14 @@ 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?() ? @activeItem?.getUri?()
|
||||
activeItemURI: activeItemURI
|
||||
focused: @focused
|
||||
|
||||
# Called by the Serializable mixin during deserialization.
|
||||
@@ -51,7 +56,13 @@ class Pane extends Model
|
||||
{items, activeItemURI, activeItemUri} = params
|
||||
activeItemURI ?= activeItemUri
|
||||
params.items = compact(items.map (itemState) -> atom.deserializers.deserialize(itemState))
|
||||
params.activeItem = find params.items, (item) -> (item.getURI?() ? 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
|
||||
@@ -427,13 +438,17 @@ class Pane extends Model
|
||||
@destroyItem(item) for item in @getItems() when item isnt @activeItem
|
||||
|
||||
promptToSaveItem: (item) ->
|
||||
if typeof item.getUri is 'function' and typeof item.getURI isnt 'function'
|
||||
Grim.deprecate("Implement `::getURI` on pane items instead of `::getUri`")
|
||||
return true unless item.shouldPromptToSave?()
|
||||
|
||||
return true unless (typeof item.getURI is 'function' or typeof item.getUri is 'function') and 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?() ? 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"]
|
||||
|
||||
@@ -460,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?() ? 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
|
||||
@@ -490,7 +510,13 @@ class Pane extends Model
|
||||
#
|
||||
# * `uri` {String} containing a URI.
|
||||
itemForURI: (uri) ->
|
||||
find @items, (item) -> item.getURI?() is uri or item.getUri?() is 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) ->
|
||||
Grim.deprecate("Use `::itemForURI` instead.")
|
||||
|
||||
@@ -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
-9
@@ -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'
|
||||
@@ -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
|
||||
###
|
||||
@@ -655,18 +694,22 @@ class Workspace extends Model
|
||||
|
||||
# Removes the item's uri from the list of potential items to reopen.
|
||||
itemOpened: (item) ->
|
||||
if typeof item.getUri is 'function' and not typeof item.getURI is 'function'
|
||||
deprecate("Pane items should implement `::getURI` instead of `::getUri`.")
|
||||
if typeof item.getURI is 'function'
|
||||
uri = item.getURI()
|
||||
else if typeof item.getUri is 'function'
|
||||
uri = item.getUri()
|
||||
|
||||
if uri = item.getURI?() ? item.getUri?()
|
||||
if uri?
|
||||
_.remove(@destroyedItemURIs, uri)
|
||||
|
||||
# Adds the destroyed item's uri to the list of items to reopen.
|
||||
didDestroyPaneItem: ({item}) =>
|
||||
if typeof item.getUri is 'function' and not typeof item.getURI is 'function'
|
||||
deprecate("Pane items should implement `::getURI` instead of `::getUri`.")
|
||||
if typeof item.getURI is 'function'
|
||||
uri = item.getURI()
|
||||
else if typeof item.getUri is 'function'
|
||||
uri = item.getUri()
|
||||
|
||||
if uri = item.getURI?() ? item.getUri?()
|
||||
if uri?
|
||||
@destroyedItemURIs.push(uri)
|
||||
|
||||
# Called by Model superclass when destroyed
|
||||
|
||||
externo
+9
@@ -12,3 +12,12 @@
|
||||
background-color: @background-color-selected;
|
||||
}
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-family: inherit; // inherit from themes
|
||||
}
|
||||
|
||||
@@ -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