refactored package, added keymaps and menus
This commit is contained in:
parent
aa82d27d2e
commit
bb9d241ebb
|
@ -1 +0,0 @@
|
|||
* text=auto
|
|
@ -1,2 +1,3 @@
|
|||
.DS_Store
|
||||
npm-debug.log
|
||||
node_modules
|
||||
|
|
20
LICENSE
20
LICENSE
|
@ -1,20 +0,0 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 donaldpipowitch
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,22 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Donald Pipowitch
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -1,14 +1,12 @@
|
|||
# Beautify
|
||||
|
||||
[Atom package](https://github.com/einars/js-beautify)
|
||||
|
||||
> [Beautify](https://github.com/mishoo/UglifyJS2) HTML, CSS and Javascript in Atom.
|
||||
# atom-beautify package
|
||||
|
||||
[Beautify](https://github.com/einars/js-beautify) HTML, CSS and Javascript in Atom.
|
||||
|
||||
## Usage
|
||||
|
||||
Open the Command Palette, and type `Beautify`. This will beautify JS, HTML or CSS files. It will only beautify selected text, if a selection is found - if not, the whole file will be beautified.
|
||||
|
||||
You can also type `ctrl-alt-b` as a shortcut or click `Packages > Beautify` in the menu.
|
||||
|
||||
## License
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
# Keybindings require three things to be fully defined: A selector that is
|
||||
# matched against the focused element, the keystroke and the command to
|
||||
# execute.
|
||||
#
|
||||
# Below is a basic keybinding which registers on all platforms by applying to
|
||||
# the root workspace element.
|
||||
|
||||
# For more detailed documentation see
|
||||
# https://atom.io/docs/latest/advanced/keymaps
|
||||
'.workspace .editor:not(.mini)':
|
||||
'ctrl-alt-b': 'beautify'
|
|
@ -0,0 +1,14 @@
|
|||
# See https://atom.io/docs/latest/creating-a-package#menus for more details
|
||||
'context-menu':
|
||||
'.workspace .editor:not(.mini)':
|
||||
'Enable atom-beautify': 'beautify'
|
||||
|
||||
'menu': [
|
||||
{
|
||||
'label': 'Packages'
|
||||
'submenu': [
|
||||
'label': 'Beautify'
|
||||
'command': 'beautify'
|
||||
]
|
||||
}
|
||||
]
|
15
package.json
15
package.json
|
@ -1,22 +1,21 @@
|
|||
{
|
||||
"name": "beautify",
|
||||
"name": "atom-beautify",
|
||||
"main": "./lib/atom-beautify",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"description": "Beautify HTML, CSS and Javascript in Atom",
|
||||
"license": "MIT",
|
||||
"activationEvents": ["beautify"],
|
||||
"repository": "https://github.com/donaldpipowitch/atom-beautify",
|
||||
"activationEvents": [
|
||||
"beautify"
|
||||
],
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Donald Pipowitch",
|
||||
"email": "pipo@senaeh.de",
|
||||
"url": "https://github.com/donaldpipowitch"
|
||||
},
|
||||
"engines": {
|
||||
"atom": ">=0.50.0"
|
||||
"atom": ">0.50.0"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"dependencies": {
|
||||
"js-beautify": "~1.4.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
AtomBeautify = require '../lib/atom-beautify'
|
||||
|
||||
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
|
||||
#
|
||||
# To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit`
|
||||
# or `fdescribe`). Remove the `f` to unfocus the block.
|
||||
|
||||
describe "AtomBeautify", ->
|
||||
activationPromise = null
|
||||
|
||||
beforeEach ->
|
||||
atom.workspaceView = new WorkspaceView
|
||||
activationPromise = atom.packages.activatePackage('atomBeautify')
|
||||
|
||||
# describe "when the beautify event is triggered", ->
|
||||
# it "attaches and then detaches the view", ->
|
||||
# expect(atom.workspaceView.find('.atom-beautify')).not.toExist()
|
||||
#
|
||||
# # This is an activation event, triggering it will cause the package to be
|
||||
# # activated.
|
||||
# atom.workspaceView.trigger 'beautify'
|
||||
#
|
||||
# waitsForPromise ->
|
||||
# activationPromise
|
||||
#
|
||||
# runs ->
|
||||
# expect(atom.workspaceView.find('.atom-beautify')).toExist()
|
||||
# atom.workspaceView.trigger 'beautify'
|
||||
# expect(atom.workspaceView.find('.atom-beautify')).not.toExist()
|
Loading…
Reference in New Issue