Updates to Atoms new API

Small changes for the the new API
This commit is contained in:
Alejandro Paredes Alva 2015-01-27 11:58:49 +01:00
parent 9566a49743
commit d24a454ef7
5 changed files with 8 additions and 6 deletions

View File

@ -114,7 +114,7 @@ beautify = ({onSave}) ->
# console.log 'Beautify time!'
# Get current editor
editor = atom.workspace.getActiveEditor()
editor = atom.workspace.getActiveTextEditor()
# Check if there is an active editor
if not editor?
return showError(new Error("Active Editor not found. "
@ -211,7 +211,7 @@ beautifyDirectory = ({target}) ->
return
handleSaveEvent = =>
atom.workspace.eachEditor (editor) =>
atom.workspace.observeTextEditors (editor) =>
buffer = editor.getBuffer()
plugin.unsubscribe buffer
if atom.config.get("atom-beautify.beautifyOnSave")

View File

@ -1,4 +1,5 @@
{View} = require "atom"
{View} = require 'space-pen'
{TextEditorView} = require 'atom-space-pen-views'
module.exports =
class LoadingView extends View
@ -35,4 +36,4 @@ class LoadingView extends View
show: =>
if not @.hasParent()
atom.workspaceView.appendToTop @
atom.workspace.addTopPanel(item: @)

View File

@ -1,6 +1,6 @@
# See https://atom.io/docs/latest/creating-a-package#menus for more details
'context-menu':
'.workspace .editor:not(.mini)':
'atom-workspace atom-text-editor:not(.mini)':
'Enable atom-beautify': 'beautify:beautify-editor'
'.tree-view .file > .name':
'Beautify File': 'beautify:beautify-file'

View File

@ -61,7 +61,8 @@
"strip-json-comments": "^0.1.3",
"temp": "^0.8.0",
"typescript-formatter": "~0.1.4",
"yaml-front-matter": "^3.2.3"
"yaml-front-matter": "^3.2.3",
"atom-space-pen-views": "^2.0.3"
},
"activationCommands": {
"atom-workspace": [