mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Rename Editor attach and remove events in accordance w/ new scheme
'editor-open' -> 'editor:attached' 'before-remove' -> 'editor:will-be-removed'
This commit is contained in:
@@ -451,10 +451,10 @@ describe "Editor", ->
|
||||
editor.splitLeft().remove()
|
||||
editor.splitRight().remove()
|
||||
|
||||
describe "editor-open event", ->
|
||||
it 'only triggers an editor-open event when it is first added to the DOM', ->
|
||||
describe "editor:attached event", ->
|
||||
it 'only triggers an editor:attached event when it is first added to the DOM', ->
|
||||
openHandler = jasmine.createSpy('openHandler')
|
||||
editor.on 'editor-open', openHandler
|
||||
editor.on 'editor:attached', openHandler
|
||||
|
||||
editor.simulateDomAttachment()
|
||||
expect(openHandler).toHaveBeenCalled()
|
||||
|
||||
@@ -422,7 +422,7 @@ class Editor extends View
|
||||
|
||||
@resetDisplay()
|
||||
|
||||
@trigger 'editor-open', [this]
|
||||
@trigger 'editor:attached', [this]
|
||||
|
||||
edit: (editSession) ->
|
||||
index = @editSessions.indexOf(editSession)
|
||||
@@ -680,7 +680,7 @@ class Editor extends View
|
||||
remove: (selector, keepData) ->
|
||||
return super if keepData
|
||||
|
||||
@trigger 'before-remove'
|
||||
@trigger 'editor:will-be-removed'
|
||||
|
||||
@destroyEditSessions()
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ module.exports =
|
||||
class Autocomplete extends SelectList
|
||||
@activate: (rootView) ->
|
||||
new Autocomplete(editor) for editor in rootView.getEditors()
|
||||
rootView.on 'editor-open', (e, editor) -> new Autocomplete(editor) unless editor.mini
|
||||
rootView.on 'editor:attached', (e, editor) -> new Autocomplete(editor) unless editor.mini
|
||||
|
||||
@viewClass: -> "autocomplete #{super}"
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ module.exports =
|
||||
|
||||
activate: (@rootView) ->
|
||||
@loadSnippets()
|
||||
@rootView.on 'editor-open', (e, editor) => @enableSnippetsInEditor(editor)
|
||||
@rootView.on 'editor:attached', (e, editor) => @enableSnippetsInEditor(editor)
|
||||
|
||||
loadSnippets: ->
|
||||
snippetsDir = fs.join(config.configDirPath, 'snippets')
|
||||
|
||||
@@ -8,7 +8,7 @@ class StatusBar extends View
|
||||
for editor in rootView.getEditors()
|
||||
@appendToEditorPane(rootView, editor) if rootView.parents('html').length
|
||||
|
||||
rootView.on 'editor-open', (e, editor) =>
|
||||
rootView.on 'editor:attached', (e, editor) =>
|
||||
@appendToEditorPane(rootView, editor)
|
||||
|
||||
@appendToEditorPane: (rootView, editor) ->
|
||||
|
||||
@@ -8,7 +8,7 @@ class Tabs extends View
|
||||
for editor in rootView.getEditors()
|
||||
@prependToEditorPane(rootView, editor) if rootView.parents('html').length
|
||||
|
||||
rootView.on 'editor-open', (e, editor) =>
|
||||
rootView.on 'editor:attached', (e, editor) =>
|
||||
@prependToEditorPane(rootView, editor)
|
||||
|
||||
@prependToEditorPane: (rootView, editor) ->
|
||||
|
||||
@@ -9,7 +9,7 @@ class WrapGuide extends View
|
||||
if rootView.parents('html').length
|
||||
@appendToEditorPane(rootView, editor)
|
||||
|
||||
rootView.on 'editor-open', (e, editor) =>
|
||||
rootView.on 'editor:attached', (e, editor) =>
|
||||
@appendToEditorPane(rootView, editor)
|
||||
|
||||
@appendToEditorPane: (rootView, editor, config) ->
|
||||
|
||||
Reference in New Issue
Block a user