Merge pull request #977 from atom/ks-space-pen-from-jquery

Use jquery through space-pen
This commit is contained in:
Kevin Sawicki
2013-10-16 15:27:33 -07:00
37 changed files with 71 additions and 9662 deletions

View File

@@ -1,4 +1,3 @@
{View, $$, $$$} = require '../src/space-pen-extensions'
{Document, Point, Range, Site} = require 'telepath'
_ = require 'underscore-plus'
@@ -7,9 +6,6 @@ _.nextTick = setImmediate
module.exports =
_: _
$: require '../src/jquery-extensions'
$$: $$
$$$: $$$
BufferedNodeProcess: require '../src/buffered-node-process'
BufferedProcess: require '../src/buffered-process'
Directory: require '../src/directory'
@@ -19,16 +15,21 @@ module.exports =
Git: require '../src/git'
Point: Point
Range: Range
ScrollView: require '../src/scroll-view'
Site: Site
stringscore: require '../vendor/stringscore'
View: View
# The following classes can't be used from a Task handler and should therefore
# only be exported when not running as a child node process
unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE
{$, $$, $$$, View} = require '../src/space-pen-extensions'
module.exports.$ = $
module.exports.$$ = $$
module.exports.$$$ = $$$
module.exports.Editor = require '../src/editor'
module.exports.pathForRepositoryUrl = require('../src/project').pathForRepositoryUrl
module.exports.RootView = require '../src/root-view'
module.exports.SelectList = require '../src/select-list'
module.exports.ScrollView = require '../src/scroll-view'
module.exports.Task = require '../src/task'
module.exports.View = View

View File

@@ -1,3 +0,0 @@
# FIXME Make jquery a package.json dependency
# This is needed so that space-pen can be require it as 'jquery'
module.exports = require '../vendor/jquery'

View File

@@ -34,7 +34,7 @@
"scandal": "0.5.0",
"season": "0.13.0",
"semver": "1.1.4",
"space-pen": "1.3.0",
"space-pen": "2.0.0",
"telepath": "0.8.1",
"temp": "0.5.0",
"underscore-plus": "0.2.0",
@@ -47,7 +47,7 @@
"solarized-dark-syntax": "0.3.0",
"archive-view": "0.11.0",
"autocomplete": "0.8.0",
"autocomplete": "0.9.0",
"autoflow": "0.4.0",
"bookmarks": "0.7.0",
"bracket-matcher": "0.7.0",
@@ -58,7 +58,7 @@
"editor-stats": "0.4.0",
"exception-reporting": "0.4.0",
"find-and-replace": "0.27.0",
"fuzzy-finder": "0.13.0",
"fuzzy-finder": "0.14.0",
"gfm": "0.5.0",
"git-diff": "0.11.0",
"gists": "0.4.0",
@@ -69,7 +69,7 @@
"link": "0.6.0",
"markdown-preview": "0.8.0",
"metrics": "0.8.0",
"package-generator": "0.11.0",
"package-generator": "0.12.0",
"release-notes": "0.4.0",
"settings-view": "0.28.0",
"snippets": "0.9.0",
@@ -82,7 +82,7 @@
"timecop": "0.5.0",
"to-the-hubs": "0.7.0",
"toml": "0.3.0",
"tree-view": "0.17.0",
"tree-view": "0.18.0",
"whitespace": "0.7.0",
"wrap-guide": "0.4.0",

View File

@@ -1,5 +1,4 @@
$ = require 'jquery'
{View, $$} = require 'space-pen'
{View, $, $$} = require '../src/space-pen-extensions'
_ = require 'underscore-plus'
{convertStackTrace} = require 'coffeestack'

View File

@@ -1,6 +0,0 @@
module.exports = ->
try
require 'jquery'
true
catch e
false

View File

@@ -1,178 +0,0 @@
{_, $, $$, View} = require 'atom'
describe 'jQuery extensions', ->
describe '$.fn.preempt(eventName, handler)', ->
[returnValue, element, events] = []
beforeEach ->
returnValue = undefined
element = $("<div>")
events = []
element.on 'foo', -> events.push(1)
element.preempt 'foo', ->
events.push(2)
returnValue
element.on 'foo', -> events.push(3)
it 'calls the preempting handler before all others', ->
element.trigger 'foo'
expect(events).toEqual [2,1,3]
describe 'when handler returns false', ->
it 'does not call subsequent handlers', ->
returnValue = false
element.trigger 'foo'
expect(events).toEqual [2]
describe 'when the event is namespaced', ->
it 'calls handler', ->
element.preempt 'foo.bar', -> events.push(4)
element.trigger 'foo'
expect(events).toEqual [4,2,1,3]
events = []
element.trigger 'foo.bar'
expect(events).toEqual [4]
events = []
element.off('.bar')
element.trigger 'foo'
expect(events).toEqual [2,1,3]
describe "$.fn.events() and $.fn.document(...)", ->
it "returns a list of all events being listened for on the target node or its ancestors, along with their documentation string", ->
view = $$ ->
@div id: 'a', =>
@div id: 'b', =>
@div id: 'c'
@div id: 'd'
view.document 'a1', "This is event A2"
view.document 'b2', "This is event b2"
view.document 'a1', "A1: Waste perfectly-good steak"
view.on 'a1', ->
view.on 'a2', ->
view.on 'b1', -> # should not appear as a duplicate
divB = view.find('#b')
divB.document 'b1', "B1: Super-sonic bomber"
divB.document 'b2', "B2: Looks evil. Kinda is."
divB.on 'b1', ->
divB.on 'b2', ->
view.find('#c').on 'c', ->
view.find('#d').on 'd', ->
expect(view.find('#c').events()).toEqual
'c': null
'b1': "B1: Super-sonic bomber"
'b2': "B2: Looks evil. Kinda is."
'a1': "A1: Waste perfectly-good steak"
'a2': null
describe "$.fn.command(eventName, [selector, options,] handler)", ->
[view, handler] = []
beforeEach ->
view = $$ ->
@div class: 'a', =>
@div class: 'b'
@div class: 'c'
handler = jasmine.createSpy("commandHandler")
it "binds the handler to the given event / selector for all argument combinations", ->
view.command 'test:foo', handler
view.trigger 'test:foo'
expect(handler).toHaveBeenCalled()
handler.reset()
view.command 'test:bar', '.b', handler
view.find('.b').trigger 'test:bar'
view.find('.c').trigger 'test:bar'
expect(handler.callCount).toBe 1
handler.reset()
view.command 'test:baz', doc: 'Spaz', handler
view.trigger 'test:baz'
expect(handler).toHaveBeenCalled()
handler.reset()
view.command 'test:quux', '.c', doc: 'Lorem', handler
view.find('.b').trigger 'test:quux'
view.find('.c').trigger 'test:quux'
expect(handler.callCount).toBe 1
it "passes the 'data' option through when binding the event handler", ->
view.command 'test:foo', data: "bar", handler
view.trigger 'test:foo'
expect(handler.argsForCall[0][0].data).toBe 'bar'
it "sets a custom docstring if the 'doc' option is specified", ->
view.command 'test:foo', doc: "Foo!", handler
expect(view.events()).toEqual 'test:foo': 'Test: Foo!'
it "capitalizes the 'github' prefix how we like it", ->
view.command 'github:spelling', handler
expect(view.events()).toEqual 'github:spelling': 'GitHub: Spelling'
describe "$.fn.scrollUp/Down/ToTop/ToBottom", ->
it "scrolls the element in the specified way if possible", ->
view = $$ -> @div => _.times 20, => @div('A')
view.css(height: 100, width: 100, overflow: 'scroll')
view.attachToDom()
view.scrollUp()
expect(view.scrollTop()).toBe 0
view.scrollDown()
expect(view.scrollTop()).toBeGreaterThan 0
previousScrollTop = view.scrollTop()
view.scrollDown()
expect(view.scrollTop()).toBeGreaterThan previousScrollTop
view.scrollToBottom()
expect(view.scrollTop()).toBe view.prop('scrollHeight') - 100
previousScrollTop = view.scrollTop()
view.scrollDown()
expect(view.scrollTop()).toBe previousScrollTop
view.scrollUp()
expect(view.scrollTop()).toBeLessThan previousScrollTop
previousScrollTop = view.scrollTop()
view.scrollUp()
expect(view.scrollTop()).toBeLessThan previousScrollTop
view.scrollToTop()
expect(view.scrollTop()).toBe 0
describe "Event.prototype", ->
class GrandchildView extends View
@content: -> @div class: 'grandchild'
class ChildView extends View
@content: ->
@div class: 'child', =>
@subview 'grandchild', new GrandchildView
class ParentView extends View
@content: ->
@div class: 'parent', =>
@subview 'child', new ChildView
[parentView, event] = []
beforeEach ->
parentView = new ParentView
eventHandler = jasmine.createSpy('eventHandler')
parentView.on 'foo', '.child', eventHandler
parentView.child.grandchild.trigger 'foo'
event = eventHandler.argsForCall[0][0]
describe ".currentTargetView()", ->
it "returns the current target's space pen view", ->
expect(event.currentTargetView()).toBe parentView.child
describe ".targetView()", ->
it "returns the target's space pen view", ->
expect(event.targetView()).toBe parentView.child.grandchild

View File

@@ -36,7 +36,7 @@ describe "Pane", ->
expect(pane.activeItem).toBe view1
pane.showItem(view2)
expect(view1.css('display')).toBe 'none'
expect(view2.css('display')).toBe ''
expect(view2.css('display')).not.toBe 'none'
expect(pane.activeItem).toBe view2
it "triggers 'pane:active-item-changed' if the item isn't already the activeItem", ->
@@ -90,7 +90,7 @@ describe "Pane", ->
it "appends and shows a view to display the item based on its `.getViewClass` method", ->
pane.showItem(editSession1)
editor = pane.activeView
expect(editor.css('display')).toBe ''
expect(editor.css('display')).not.toBe 'none'
expect(editor.activeEditSession).toBe editSession1
describe "when a valid view has already been appended for another item", ->
@@ -99,7 +99,7 @@ describe "Pane", ->
pane.showItem(editSession2)
expect(pane.itemViews.find('.editor').length).toBe 2
editor = pane.activeView
expect(editor.css('display')).toBe ''
expect(editor.css('display')).not.toBe 'none'
expect(editor.activeEditSession).toBe editSession2
it "creates a new view with the item", ->
@@ -498,6 +498,9 @@ describe "Pane", ->
expect(pane2.getNextPane()).toBe pane
describe "when the pane is focused", ->
beforeEach ->
container.attachToDom()
it "focuses the active item view", ->
focusHandler = jasmine.createSpy("focusHandler")
pane.activeItem.on 'focus', focusHandler

View File

@@ -92,6 +92,9 @@ describe "RootView", ->
expect(rootView.getEditors().length).toBe 0
describe "focus", ->
beforeEach ->
rootView.attachToDom()
describe "when there is an active view", ->
it "hands off focus to the active view", ->
editor = rootView.getActiveView()

View File

@@ -160,7 +160,7 @@ describe "SelectList", ->
describe "when the mini editor loses focus", ->
it "triggers the cancelled hook and detaches the select list", ->
spyOn(selectList, 'detach')
miniEditor.trigger 'focusout'
miniEditor.hiddenInput.trigger 'focusout'
expect(selectList.cancelled).toHaveBeenCalled()
expect(selectList.detach).toHaveBeenCalled()

View File

@@ -8,10 +8,7 @@ try
document.title = "Spec Suite"
runSpecSuite './spec-suite'
catch error
unless atom.getLoadSettings().exitWhenDone
atom.getCurrentWindow().setSize(800, 600)
atom.getCurrentWindow().center()
atom.openDevTools()
console.error(error.stack ? error)
atom.exit(1) if atom.getLoadSettings().exitWhenDone
if atom?.getLoadSettings().exitWhenDone
atom.exit(1)
else
throw error

View File

@@ -1,26 +1,6 @@
Task = require '../src/task'
describe "Task", ->
describe "populating the window with fake properties", ->
describe "when jQuery is loaded in a child process", ->
it "doesn't log to the console", ->
spyOn(console, 'log')
spyOn(console, 'error')
spyOn(console, 'warn')
jqueryTask = new Task(require.resolve('./fixtures/jquery-task-handler'))
jqueryLoaded = false
jqueryTask.start (loaded) -> jqueryLoaded = loaded
waitsFor "child process to start and jquery to be required", 5000, ->
jqueryLoaded
runs ->
expect(jqueryLoaded).toBeTruthy()
expect(console.log).not.toHaveBeenCalled()
expect(console.error).not.toHaveBeenCalled()
expect(console.warn).not.toHaveBeenCalled()
describe "@once(taskPath, args..., callback)", ->
it "terminates the process after it completes", ->
handlerResult = null

View File

@@ -24,7 +24,7 @@ describe "Window", ->
describe "when the window is blurred", ->
beforeEach ->
$(window).trigger 'blur'
$(window).triggerHandler 'blur'
afterEach ->
$('body').removeClass('is-blurred')
@@ -34,7 +34,7 @@ describe "Window", ->
describe "when the window is focused again", ->
it "removes the .is-blurred class from the body", ->
$(window).trigger 'focus'
$(window).triggerHandler 'focus'
expect($("body")).not.toHaveClass("is-blurred")
describe "window:close event", ->
@@ -52,13 +52,18 @@ describe "Window", ->
expect(beforeunload).toHaveBeenCalled()
describe "beforeunload event", ->
[beforeUnloadEvent] = []
beforeEach ->
beforeUnloadEvent = $.Event(new Event('beforeunload'))
describe "when pane items are are modified", ->
it "prompts user to save and and calls rootView.confirmClose", ->
spyOn(rootView, 'confirmClose').andCallThrough()
spyOn(atom, "confirmSync").andReturn(2)
editSession = rootView.openSync("sample.js")
editSession.insertText("I look different, I feel different.")
$(window).trigger 'beforeunload'
$(window).trigger(beforeUnloadEvent)
expect(rootView.confirmClose).toHaveBeenCalled()
expect(atom.confirmSync).toHaveBeenCalled()
@@ -66,14 +71,14 @@ describe "Window", ->
spyOn(atom, "confirmSync").andReturn(2)
editSession = rootView.openSync("sample.js")
editSession.insertText("I look different, I feel different.")
expect(window.onbeforeunload(new Event('beforeunload'))).toBeTruthy()
$(window).trigger(beforeUnloadEvent)
expect(atom.confirmSync).toHaveBeenCalled()
it "prompts user to save and handler returns false if dialog is canceled", ->
spyOn(atom, "confirmSync").andReturn(1)
editSession = rootView.openSync("sample.js")
editSession.insertText("I look different, I feel different.")
expect(window.onbeforeunload(new Event('beforeunload'))).toBeFalsy()
$(window).trigger(beforeUnloadEvent)
expect(atom.confirmSync).toHaveBeenCalled()
describe ".unloadEditorWindow()", ->

View File

@@ -3,7 +3,7 @@ Package = require './package'
fsUtils = require './fs-utils'
path = require 'path'
_ = require 'underscore-plus'
$ = require './jquery-extensions'
{$} = require './space-pen-extensions'
CSON = require 'season'
{Emitter} = require 'emissary'
@@ -236,7 +236,7 @@ class AtomPackage extends Package
disabledHandler = ->
element = $(event.target)
while element.length
if eventHandlers = element.data('events')?[event.type]
if eventHandlers = element.handlers()?[event.type]
for eventHandler in eventHandlers
eventHandler.disabledHandler = eventHandler.handler
eventHandler.handler = disabledHandler

View File

@@ -5,7 +5,7 @@ Emitter::trigger = (args...) -> @emit(args...)
Emitter::subscriptionCount = (args...) -> @getSubscriptionCount(args...)
fsUtils = require './fs-utils'
$ = require './jquery-extensions'
{$} = require './space-pen-extensions'
_ = require 'underscore-plus'
Package = require './package'
ipc = require 'ipc'

View File

@@ -1,4 +1,4 @@
$ = require './jquery-extensions'
{$} = require './space-pen-extensions'
_ = require 'underscore-plus'
fsUtils = require './fs-utils'

View File

@@ -1,4 +1,4 @@
$ = require 'jquery'
{$} = require './space-pen-extensions'
_ = require 'underscore-plus'
remote = require 'remote'

View File

@@ -43,7 +43,7 @@ class CursorView extends View
pixelPosition = @getPixelPosition()
unless _.isEqual(@lastPixelPosition, pixelPosition)
changedPosition = true
@lastPixelPosition = pixelPosition
@css(pixelPosition)
@trigger 'cursor:moved'

View File

@@ -1,4 +1,4 @@
{View, $$} = require './space-pen-extensions'
{View, $, $$} = require './space-pen-extensions'
TextBuffer = require './text-buffer'
Gutter = require './gutter'
{Point, Range} = require 'telepath'
@@ -6,7 +6,6 @@ EditSession = require './edit-session'
CursorView = require './cursor-view'
SelectionView = require './selection-view'
fsUtils = require './fs-utils'
$ = require './jquery-extensions'
_ = require 'underscore-plus'
MeasureRange = document.createRange()

View File

@@ -65,7 +65,7 @@ class Git
refreshOnWindowFocus ?= true
if refreshOnWindowFocus
$ = require 'jquery'
{$} = require './space-pen-extensions'
@subscribe $(window), 'focus', =>
@refreshIndex()
@refreshStatus()

View File

@@ -1,6 +1,5 @@
{View, $$, $$$} = require './space-pen-extensions'
{View, $, $$, $$$} = require './space-pen-extensions'
{Range} = require 'telepath'
$ = require './jquery-extensions'
_ = require 'underscore-plus'
# Private: Represents the portion of the {Editor} containing row numbers.

View File

@@ -1,142 +0,0 @@
$ = require '../vendor/jquery'
_ = require 'underscore-plus'
$.fn.scrollBottom = (newValue) ->
if newValue?
@scrollTop(newValue - @height())
else
@scrollTop() + @height()
$.fn.scrollDown = ->
@scrollTop(@scrollTop() + $(window).height() / 20)
$.fn.scrollUp = ->
@scrollTop(@scrollTop() - $(window).height() / 20)
$.fn.scrollToTop = ->
@scrollTop(0)
$.fn.scrollToBottom = ->
@scrollTop(@prop('scrollHeight'))
$.fn.scrollRight = (newValue) ->
if newValue?
@scrollLeft(newValue - @width())
else
@scrollLeft() + @width()
$.fn.pageUp = ->
@scrollTop(@scrollTop() - @height())
$.fn.pageDown = ->
@scrollTop(@scrollTop() + @height())
$.fn.isOnDom = ->
@closest(document.body).length is 1
$.fn.isVisible = ->
!@isHidden()
$.fn.isHidden = ->
# We used to check @is(':hidden'). But this is much faster than the
# offsetWidth/offsetHeight check + all the pseudo selector mess in jquery.
style = this[0].style
if style.display == 'none' or not @isOnDom()
true
else if style.display
false
else
getComputedStyle(this[0]).display == 'none'
$.fn.isDisabled = ->
!!@attr('disabled')
$.fn.enable = ->
@removeAttr('disabled')
$.fn.disable = ->
@attr('disabled', 'disabled')
$.fn.insertAt = (index, element) ->
target = @children(":eq(#{index})")
if target.length
$(element).insertBefore(target)
else
@append(element)
$.fn.removeAt = (index) ->
@children(":eq(#{index})").remove()
$.fn.indexOf = (child) ->
@children().toArray().indexOf($(child)[0])
$.fn.containsElement = (element) ->
(element[0].compareDocumentPosition(this[0]) & 8) == 8
$.fn.preempt = (eventName, handler) ->
@on eventName, (e, args...) ->
if handler(e, args...) == false then e.stopImmediatePropagation()
eventNameWithoutNamespace = eventName.split('.')[0]
handlers = @data('events')[eventNameWithoutNamespace]
handlers.unshift(handlers.pop())
$.fn.hasParent = ->
@parent()[0]?
$.fn.flashError = ->
@addClass 'error'
removeErrorClass = => @removeClass 'error'
window.setTimeout(removeErrorClass, 300)
$.fn.trueHeight = ->
this[0].getBoundingClientRect().height
$.fn.trueWidth = ->
this[0].getBoundingClientRect().width
$.fn.document = (eventName, docString) ->
eventDescriptions = {}
eventDescriptions[eventName] = docString
@data('documentation', {}) unless @data('documentation')
_.extend(@data('documentation'), eventDescriptions)
$.fn.events = ->
documentation = @data('documentation') ? {}
events = {}
for eventName of @data('events') ? {}
events[eventName] = documentation[eventName] ? null
if @hasParent()
_.extend(@parent().events(), events)
else
events
$.fn.command = (eventName, selector, options, handler) ->
if not options?
handler = selector
selector = null
else if not handler?
handler = options
options = null
if selector? and typeof(selector) is 'object'
options = selector
selector = null
@document(eventName, _.humanizeEventName(eventName, options?["doc"]))
@on(eventName, selector, options?['data'], handler)
$.fn.iconSize = (size) ->
@width(size).height(size).css('font-size', size)
$.fn.intValue = ->
parseInt(@text())
$.Event.prototype.abortKeyBinding = ->
$.Event.prototype.currentTargetView = -> $(this.currentTarget).view()
$.Event.prototype.targetView = -> $(this.target).view()
module.exports = $

View File

@@ -1,4 +1,4 @@
$ = require './jquery-extensions'
{$} = require './space-pen-extensions'
_ = require 'underscore-plus'
fsUtils = require './fs-utils'
path = require 'path'

View File

@@ -1,5 +1,4 @@
$ = require './jquery-extensions'
{View} = require './space-pen-extensions'
{$, View} = require './space-pen-extensions'
telepath = require 'telepath'
### Internal ###

View File

@@ -1,4 +1,4 @@
$ = require './jquery-extensions'
{$} = require './space-pen-extensions'
_ = require 'underscore-plus'
PaneAxis = require './pane-axis'

View File

@@ -1,6 +1,5 @@
{View} = require './space-pen-extensions'
{$, View} = require './space-pen-extensions'
Pane = require './pane'
$ = require './jquery-extensions'
telepath = require 'telepath'
# Private: Manages the list of panes within a {RootView}
@@ -114,7 +113,8 @@ class PaneContainer extends View
@empty()
if root?
@append(root)
@itemAdded(root.activeItem) if root.activeItem
@itemAdded(root.activeItem) if root.activeItem?
root.makeActive?()
@state.set(root: root?.getState())
removeChild: (child) ->

View File

@@ -1,4 +1,4 @@
$ = require './jquery-extensions'
{$} = require './space-pen-extensions'
_ = require 'underscore-plus'
PaneAxis = require './pane-axis'

View File

@@ -1,6 +1,5 @@
{dirname} = require 'path'
{View} = require './space-pen-extensions'
$ = require './jquery-extensions'
{$, View} = require './space-pen-extensions'
_ = require 'underscore-plus'
telepath = require 'telepath'
PaneRow = require './pane-row'
@@ -18,7 +17,7 @@ class Pane extends View
@acceptsDocuments: true
@content: (wrappedView) ->
@div class: 'pane', =>
@div class: 'pane', tabindex: -1, =>
@div class: 'item-views', outlet: 'itemViews'
@deserialize: (state) ->
@@ -94,7 +93,6 @@ class Pane extends View
@attached = true
@trigger 'pane:attached', [this]
# Public: Focus this pane.
makeActive: ->
wasActive = @isActive()
@@ -169,7 +167,7 @@ class Pane extends View
view = @viewForItem(item)
@itemViews.children().not(view).hide()
@itemViews.append(view) unless view.parent().is(@itemViews)
view.show()
view.show() if @attached
view.focus() if isFocused
@activeItem = item
@activeView = view
@@ -414,6 +412,7 @@ class Pane extends View
when 'before' then parent.insertChildBefore(this, newPane)
when 'after' then parent.insertChildAfter(this, newPane)
@getContainer().adjustPaneDimensions()
newPane.makeActive()
newPane.focus()
newPane

View File

@@ -2,8 +2,7 @@ fs = require 'fs'
ipc = require 'ipc'
path = require 'path'
Q = require 'q'
$ = require './jquery-extensions'
{$$, View} = require './space-pen-extensions'
{$, $$, View} = require './space-pen-extensions'
fsUtils = require './fs-utils'
_ = require 'underscore-plus'
telepath = require 'telepath'
@@ -56,7 +55,7 @@ class RootView extends View
# Private:
@content: (state) ->
@div id: 'root-view', =>
@div id: 'root-view', tabindex: -1, =>
@div id: 'horizontal', outlet: 'horizontal', =>
@div id: 'vertical', outlet: 'vertical', =>
@div outlet: 'panes'
@@ -154,6 +153,7 @@ class RootView extends View
focusableChild.focus()
false
else
$(document.body).focus()
true
# Private:

View File

@@ -1,5 +1,4 @@
$ = require './jquery-extensions'
{ View } = require './space-pen-extensions'
{$, View} = require './space-pen-extensions'
Editor = require './editor'
fuzzyFilter = require './fuzzy-filter'
@@ -29,7 +28,7 @@ class SelectList extends View
# Public:
initialize: ->
@miniEditor.getBuffer().on 'changed', => @schedulePopulateList()
@miniEditor.on 'focusout', => @cancel() unless @cancelling
@miniEditor.hiddenInput.on 'focusout', => @cancel() unless @cancelling
@on 'core:move-up', => @selectPreviousItem()
@on 'core:move-down', => @selectNextItem()
@on 'core:move-to-top', =>

View File

@@ -1,12 +1,12 @@
_ = require 'underscore-plus'
spacePen = require 'space-pen'
jQuery = require './jquery-extensions'
ConfigObserver = require './config-observer'
{Subscriber} = require 'emissary'
_.extend spacePen.View.prototype, ConfigObserver
Subscriber.includeInto(spacePen.View)
jQuery = spacePen.jQuery
originalCleanData = jQuery.cleanData
jQuery.cleanData = (elements) ->
for element in elements

View File

@@ -1,7 +1,6 @@
_ = require 'underscore-plus'
jQuery = require './jquery-extensions'
Specificity = require '../vendor/specificity'
{$$} = require './space-pen-extensions'
{$, $$} = require './space-pen-extensions'
fsUtils = require './fs-utils'
{Emitter} = require 'emissary'
NullGrammar = require './null-grammar'
@@ -107,7 +106,7 @@ class Syntax
matchingPropertiesForElement: (element, candidates) ->
matchingScopedProperties = candidates.filter ({selector}) ->
jQuery.find.matchesSelector(element, selector)
$.find.matchesSelector(element, selector)
matchingScopedProperties.sort (a, b) ->
if a.specificity == b.specificity
b.index - a.index

View File

@@ -4,7 +4,7 @@ Package = require './package'
AtomPackage = require './atom-package'
_ = require 'underscore-plus'
$ = require './jquery-extensions'
{$} = require './space-pen-extensions'
fsUtils = require './fs-utils'
# Private: Handles discovering and loading available themes.

View File

@@ -1,4 +1,4 @@
$ = require './jquery-extensions'
{$} = require './space-pen-extensions'
_ = require 'underscore-plus'
ipc = require 'ipc'
shell = require 'shell'
@@ -21,7 +21,7 @@ class WindowEventHandler
@subscribe $(window), 'focus', -> $("body").removeClass('is-blurred')
@subscribe $(window), 'blur', -> $("body").addClass('is-blurred')
@subscribe $(window), 'blur', -> $("body").addClass('is-blurred')
@subscribe $(window), 'window:open-path', (event, {pathToOpen, initialLine}) ->
unless fsUtils.isDirectorySync(pathToOpen)

View File

@@ -1,5 +1,5 @@
path = require 'path'
$ = require './jquery-extensions'
{$} = require './space-pen-extensions'
_ = require 'underscore-plus'
ipc = require 'ipc'
WindowEventHandler = require './window-event-handler'

View File

@@ -22,6 +22,6 @@
}
</script>
</head>
<body>
<body tabindex="-1">
</body>
</html>

View File

@@ -175,4 +175,4 @@ beforeEach(function() {
afterEach(function() {
jasmine.JQuery.events.cleanUp();
});
})(require('jquery'));
})(require('../src/space-pen-extensions').jQuery);

9244
vendor/jquery.js vendored

File diff suppressed because it is too large Load Diff