├── .editorconfig ├── LICENSE.md ├── README.md ├── coffeelint.json ├── keymaps └── open-in-browser.cson ├── lib └── open-in-browser.coffee ├── menus └── open-in-browser.cson └── package.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Open in Browser Atom.io Package 2 | 3 | [![Atom Package](https://img.shields.io/apm/v/open-in-browser.svg)](https://atom.io/packages/open-in-browser) 4 | [![Atom Package Downloads](https://img.shields.io/apm/dm/open-in-browser.svg)](https://atom.io/packages/open-in-browser) 5 | [![Build Status (Linux)](https://travis-ci.org/magbicaleman/open-in-browser.svg?branch=master)](https://travis-ci.org/magbicaleman/open-in-browser) 6 | 7 | [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/magbicaleman/open-in-browser/blob/master/LICENSE.md) 8 | 9 | A very simple Open in Browser Atom.io Package. This allows you to right click 10 | and have a menu that will open the current file in your default program. That 11 | opens that extension. **Files will open in your default browser or 12 | application**. 13 | 14 | ## v 0.5.0 15 | - Huge thanks to [ldez](https://github.com/ldez) for the contributions on pull request [#34](https://github.com/magbicaleman/open-in-browser/pull/34) which solves a few issues some users were having. 16 | 17 | ## v 0.4.7 18 | * "Open In Browser" context menu, from tree view or text editor pane, should be 19 | functional when nuclide package is installed 20 | * Should Fix 21 | * [Not compatible with nuclide-file-tree :(](https://github.com/magbicaleman/open-in-browser/issues/29) 22 | * by @aiboy 23 | 24 | ## v 0.4.6 25 | * "Open In Browser" context menu, from tree view or text editor pane, should be 26 | functional 27 | * Should Fix 28 | * [Failed to activate the open-in-browser package](https://github.com/magbicaleman/open-in-browser/issues/17) 29 | 30 | ## v 0.4.5 31 | * Had to apply fixes differently because the pull-request was using outdated version. 32 | * [fix deprecations](https://github.com/andya9/open-in-browser/commit/de3e796bd6f26e3e87c43ac56664b58f7558c93e) 33 | * by @andya9 34 | 35 | ## v 0.4.4 36 | 37 | * [fixed deprecation of stylesheets folder](https://github.com/magbicaleman/open-in-browser/pull/14) 38 | * by @andya9 39 | 40 | ## v 0.4.3 41 | 42 | * [Fixes deprecation warnings and some indentations](https://github.com/magbicaleman/open-in-browser/pull/12) 43 | * by @zimme 44 | 45 | 46 | ## v 0.4.2 47 | 48 | * Fixes "Open In Browser" not showing up in the workspace context menu 49 | 50 | ## v 0.4.0 51 | 52 | 53 | Update by "MetaMemoryT" 54 | 55 | Now able to right click on tree-view and select "Open in browser" 56 | 57 | Update by "mesosteros" 58 | 59 | Replace editor class with `atom-text-editor` tag. 60 | Shortcut was conflicting with meteor developers who use Ctrl-Alt-M in 61 | Meteor.js packages for Atom, so use Ctrl-Alt-Q instead. 62 | -------------------------------------------------------------------------------- /coffeelint.json: -------------------------------------------------------------------------------- 1 | { 2 | "max_line_length": { 3 | "level": "ignore" 4 | }, 5 | "no_empty_param_list": { 6 | "level": "error" 7 | }, 8 | "arrow_spacing": { 9 | "level": "error" 10 | }, 11 | "no_interpolation_in_single_quotes": { 12 | "level": "error" 13 | }, 14 | "no_debugger": { 15 | "level": "error" 16 | }, 17 | "prefer_english_operator": { 18 | "level": "error" 19 | }, 20 | "colon_assignment_spacing": { 21 | "spacing": { 22 | "left": 0, 23 | "right": 1 24 | }, 25 | "level": "error" 26 | }, 27 | "braces_spacing": { 28 | "spaces": 0, 29 | "level": "error" 30 | }, 31 | "spacing_after_comma": { 32 | "level": "error" 33 | }, 34 | "no_stand_alone_at": { 35 | "level": "error" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /keymaps/open-in-browser.cson: -------------------------------------------------------------------------------- 1 | '.platform-win32 atom-workspace atom-text-editor': 2 | 'ctrl-shift-q': 'open-in-browser:open' 3 | 4 | '.platform-linux atom-workspace atom-text-editor': 5 | 'ctrl-shift-q': 'open-in-browser:open' 6 | 7 | '.platform-darwin atom-workspace atom-text-editor': 8 | 'cmd-shift-q': 'open-in-browser:open' 9 | -------------------------------------------------------------------------------- /lib/open-in-browser.coffee: -------------------------------------------------------------------------------- 1 | {CompositeDisposable} = require 'atom' 2 | opn = require 'opn' 3 | 4 | module.exports = 5 | 6 | subscriptions: null 7 | 8 | activate: -> 9 | @subscriptions = new CompositeDisposable 10 | @subscriptions.add atom.commands.add 'atom-text-editor', 11 | 'open-in-browser:open', @openEditor.bind(this) 12 | @subscriptions.add atom.commands.add '.tree-view .file', 13 | 'open-in-browser:open-tree-view', @openTreeView.bind(this) 14 | 15 | getFilePath: -> atom.workspace.getActiveTextEditor().getPath() 16 | 17 | openEditor: -> 18 | @open @getFilePath() 19 | 20 | openTreeView: ({target}) -> 21 | @open target.dataset.path 22 | 23 | open: (filePath) -> 24 | opn(filePath).catch (error) -> 25 | atom.notifications.addError error.toString(), detail: error.stack or '', dismissable: true 26 | console.error error 27 | 28 | deactivate: -> 29 | @subscriptions?.dispose() 30 | -------------------------------------------------------------------------------- /menus/open-in-browser.cson: -------------------------------------------------------------------------------- 1 | # See https://atom.io/docs/latest/creating-a-package#menus for more details 2 | 3 | 'context-menu': 4 | 'atom-text-editor': [ 5 | label: 'Open in Browser', command: 'open-in-browser:open' 6 | ] 7 | '.tree-view .file': [ 8 | label: 'Open in Browser', command: 'open-in-browser:open-tree-view' 9 | ] 10 | 11 | menu: [ 12 | label: 'Packages' 13 | submenu: [ 14 | label: 'Open in Browser' 15 | submenu: [ 16 | label: 'Open In Browser', command: 'open-in-browser:open' 17 | ] 18 | ] 19 | ] 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "open-in-browser", 3 | "main": "./lib/open-in-browser", 4 | "version": "0.5.2", 5 | "description": "Simple Package to open file in default application", 6 | "repository": "https://github.com/magbicaleman/open-in-browser", 7 | "license": "MIT", 8 | "engines": { 9 | "atom": ">0.50.0" 10 | }, 11 | "dependencies": { 12 | "opn": "^4.0.2" 13 | }, 14 | "devDependencies": { 15 | "coffeelint": "^1.15.0" 16 | } 17 | } 18 | --------------------------------------------------------------------------------