Permalink
Browse files

Cleanup, rename command to 'fetch'

  • Loading branch information...
NickTikhonov committed Aug 18, 2016
1 parent 89e174a commit aa3ec5585b0aa049393351a30be14590df09c29a
Showing with 15 additions and 64 deletions.
  1. +1 −1 keymaps/sourcefetch.json
  2. +0 −29 lib/sourcefetch-view.js
  3. +9 −29 lib/sourcefetch.js
  4. +4 −4 menus/sourcefetch.json
  5. +1 −1 package.json
View
@@ -1,5 +1,5 @@
{
"atom-workspace": {
"ctrl-alt-o": "sourcefetch:toggle"
"ctrl-alt-o": "sourcefetch:fetch"
}
}
View

This file was deleted.

Oops, something went wrong.
View
@@ -1,49 +1,29 @@
'use babel';
import SourcefetchView from './sourcefetch-view';
import { CompositeDisposable } from 'atom';
import { CompositeDisposable } from 'atom'
export default {
sourcefetchView: null,
modalPanel: null,
subscriptions: null,
activate(state) {
this.sourcefetchView = new SourcefetchView(state.sourcefetchViewState);
this.modalPanel = atom.workspace.addModalPanel({
item: this.sourcefetchView.getElement(),
visible: false
});
activate() {
this.subscriptions = new CompositeDisposable()
// Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable
this.subscriptions = new CompositeDisposable();
// Register command that toggles this view
this.subscriptions.add(atom.commands.add('atom-workspace', {
'sourcefetch:toggle': () => this.toggle()
}));
'sourcefetch:fetch': () => this.fetch()
}))
},
deactivate() {
this.modalPanel.destroy();
this.subscriptions.dispose();
this.sourcefetchView.destroy();
},
serialize() {
return {
sourcefetchViewState: this.sourcefetchView.serialize()
};
this.subscriptions.dispose()
},
toggle() {
fetch() {
let editor
if (editor = atom.workspace.getActiveTextEditor()) {
let selection = editor.getSelectedText()
let reversed = selection.split("").reverse().join("")
editor.insertText(reversed)
selection = selection.split("").reverse().join("")
editor.insertText(selection)
}
}
};
View
@@ -2,8 +2,8 @@
"context-menu": {
"atom-text-editor": [
{
"label": "Toggle sourcefetch",
"command": "sourcefetch:toggle"
"label": "Fetch code",
"command": "sourcefetch:fetch"
}
]
},
@@ -15,8 +15,8 @@
"label": "sourcefetch",
"submenu": [
{
"label": "Toggle",
"command": "sourcefetch:toggle"
"label": "Fetch code",
"command": "sourcefetch:fetch"
}
]
}
View
@@ -6,7 +6,7 @@
"keywords": [
],
"activationCommands": {
"atom-workspace": "sourcefetch:toggle"
"atom-workspace": "sourcefetch:fetch"
},
"repository": "https://github.com/atom/sourcefetch",
"license": "MIT",

0 comments on commit aa3ec55

Please sign in to comment.