mirror of
https://github.com/wassname/nvatom.git
synced 2026-06-27 16:10:36 +08:00
Fix more deprecation warnings
SelectListView is moved to atom-space-pen-views package from atom package.
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2014 <Your name here>
|
||||
Copyright (c) 2014 Seong Jae Lee
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
|
||||
# For more detailed documentation see
|
||||
# https://atom.io/docs/latest/advanced/keymaps
|
||||
'.atom-workspace':
|
||||
'atom-workspace':
|
||||
'ctrl-alt-o': 'notational-velocity:toggle'
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
path = require 'path'
|
||||
fs = require 'fs'
|
||||
fsPlus = require 'fs-plus'
|
||||
{$, $$, SelectListView} = require 'atom'
|
||||
{$, $$, SelectListView} = require 'atom-space-pen-views'
|
||||
|
||||
module.exports =
|
||||
class NotationalVelocityView extends SelectListView
|
||||
initialize: ->
|
||||
console.log 'initialize'
|
||||
super
|
||||
|
||||
@addClass('notational-velocity from-top overlay')
|
||||
@loadData()
|
||||
|
||||
@@ -42,7 +40,6 @@ class NotationalVelocityView extends SelectListView
|
||||
loadData: ->
|
||||
@data = []
|
||||
|
||||
# directory = '/Users/seongjae/github/notational-velocity/testdata'
|
||||
directory = atom.config.get('notational-velocity.directory')
|
||||
|
||||
for filename in fs.readdirSync(directory)
|
||||
@@ -72,10 +69,11 @@ class NotationalVelocityView extends SelectListView
|
||||
|
||||
toggle: ->
|
||||
console.log 'toggle'
|
||||
if @hasParent()
|
||||
@cancel()
|
||||
if @panel?.isVisible()
|
||||
@hide()
|
||||
else
|
||||
@attach()
|
||||
@populateList()
|
||||
@show()
|
||||
|
||||
viewForItem: (item) ->
|
||||
console.log 'viewForItem #{item}'
|
||||
@@ -89,41 +87,27 @@ class NotationalVelocityView extends SelectListView
|
||||
@div "#{content}", class: 'secondary-line'
|
||||
|
||||
confirmed: (item) ->
|
||||
# console.log 'confirmed #{item}'
|
||||
atom.workspaceView.open(item.filepath)
|
||||
console.log 'confirmed #{item}'
|
||||
atom.workspace.open(item.filepath)
|
||||
@cancel()
|
||||
|
||||
destroy: ->
|
||||
# console.log 'destroy'
|
||||
console.log 'destroy'
|
||||
@cancel()
|
||||
@remove()
|
||||
@panel?.destroy()
|
||||
|
||||
attach: ->
|
||||
# console.log 'attach'
|
||||
show: ->
|
||||
console.log 'show'
|
||||
@storeFocusedElement()
|
||||
atom.workspaceView.append(this)
|
||||
@panel ?= atom.workspace.addModalPanel(item: this)
|
||||
@panel.show()
|
||||
@focusFilterEditor()
|
||||
|
||||
# cancel: ->
|
||||
# console.log 'cancel'
|
||||
# super
|
||||
cancelled: ->
|
||||
@hide()
|
||||
|
||||
# cancelled: ->
|
||||
# console.log 'cancelled'
|
||||
# super
|
||||
|
||||
# setItems: (items=[]) ->
|
||||
# console.log 'setItems'
|
||||
# super(items)
|
||||
|
||||
# populateList: ->
|
||||
# console.log 'populateList'
|
||||
# super
|
||||
|
||||
# selectItemView: (view) ->
|
||||
# console.log 'selectItemView'
|
||||
# super(view)
|
||||
# return unless view.length
|
||||
# console.log @list.indexOf(@list.find('.selected'))
|
||||
hide: ->
|
||||
@panel?.hide()
|
||||
|
||||
populateList: ->
|
||||
console.log 'populateList'
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
{CompositeDisposable} = require 'atom'
|
||||
|
||||
module.exports =
|
||||
configDefaults:
|
||||
directory: '/'
|
||||
@@ -5,10 +7,16 @@ module.exports =
|
||||
notationalVelocityView: null
|
||||
|
||||
activate: (state) ->
|
||||
atom.workspaceView.command 'notational-velocity:toggle', =>
|
||||
@createView(state).toggle()
|
||||
# Events subscribed to in atom's system can be easily cleaned up with a
|
||||
# CompositeDisposable
|
||||
@subscriptions = new CompositeDisposable
|
||||
|
||||
# Register command that toggles this view
|
||||
@subscriptions.add atom.commands.add 'atom-workspace',
|
||||
'notational-velocity:toggle': => @createView(state).toggle()
|
||||
|
||||
deactivate: ->
|
||||
@subscriptions.dispose()
|
||||
@notationalVelocityView.destroy()
|
||||
|
||||
serialize: ->
|
||||
|
||||
+2
-1
@@ -12,6 +12,7 @@
|
||||
"atom": ">0.50.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"fs-plus": "2.x"
|
||||
"fs-plus": "2.x",
|
||||
"atom-space-pen-views": "^2.0.3"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user