-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsxbin-encoder.js
1 lines (1 loc) · 2.41 KB
/
jsxbin-encoder.js
1
"use babel";import{CompositeDisposable}from"atom";const _main=require("./modules/_main");export default{subscriptions:null,config:{growSelection:{title:"Grow selection",description:"Automatically grow the selection to the beginning and end of each selected line.",type:"boolean",default:true,order:1},encodingOptions:{type:"object",title:"Encoding",properties:{obfuscate:{title:"Obfuscate",description:"Obfuscate the selection before encoding it to **JSXBIN**. Uses [javascript-obfuscator](https://github.com/javascript-obfuscator/javascript-obfuscator).",type:"boolean",default:false,order:1},evalPosition:{title:"eval() position",description:"Insert the `eval` method **above** or **under** the selection.",type:"string",default:"under",enum:["above","under"],order:2},quotes:{title:"Quotes",description:"Use **single** or **double** quotes inside the `eval` method.",type:"string",default:"single",enum:["single","double"],order:3}},order:2},commentsOptions:{type:"object",title:"Comments",properties:{autoFold:{title:"Auto-fold",description:"Auto-fold the newly commented selection.",type:"boolean",default:true,order:1},commentStyle:{title:"Style",description:"Use **single-line** or **multi-line** comment style to comment-out the newly encoded selection.",type:"string",default:"multi-line",enum:["single-line","multi-line"],order:2}},order:3},messagesOptions:{type:"object",title:"Messages",properties:{disableNotifications:{title:"Disable notifications",description:"Choose whether to show or not a pop-up notification after each completed task.",type:"boolean",default:false,order:1},disableWarnings:{title:"Disable warnings",description:"Choose whether to show or not a pop-up warning, if the script processing time might increase or if the current language isn't supported.",type:"boolean",default:false,order:2}},order:4}},activate(state){this.subscriptions=new CompositeDisposable;this.subscriptions.add(atom.commands.add("atom-workspace",{"jsxbin-encoder:encode":()=>this.encode(),"jsxbin-encoder:block_comment":()=>this.block_comment(),"jsxbin-encoder:block_uncomment":()=>this.block_uncomment()}))},deactivate(){this.subscriptions.dispose()},encode(){let editor;if(editor=atom.workspace.getActiveTextEditor()){_main.encode(editor)}},block_comment(){let editor;if(editor=atom.workspace.getActiveTextEditor()){_main.block.comment(editor)}},block_uncomment(){let editor;if(editor=atom.workspace.getActiveTextEditor()){_main.block.uncomment(editor)}}};