├── LICENSE ├── README.md ├── main.js └── package.json /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Brackets Bootstrap Snippets# 2 | 3 | A [Brackets](http://brackets.io/) extension to add Bootstrap 3 HTML5 Snippets to your page using simple shortcut keys. 4 | 5 | ## Installation ## 6 | 1. Open the Brackets Extension Manager and search for "bootstrap". 7 | 2. Download straight from GitHub using [https://github.com/codeomnitrix/bootstrap-snippets/archive/master.zip](https://github.com/codeomnitrix/bootstrap-snippets/archive/master.zip) 8 | 9 | ## Directions ## 10 | * Ctrl-Shift-N > Create a Navigation toolbar 11 | * Ctrl-Shift-P > Create a Panel 12 | * Ctrl-Shift-M > Create a Modal 13 | * Ctrl-Shift-I > Create an input group 14 | * More Components coming soon 15 | 16 | This will make the relevant snippets at cursor location. 17 | 18 | ## License ## 19 | [MIT License](LICENSE) 20 | -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | /*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */ 2 | /*global define, $, brackets, window */ 3 | 4 | /** Simple extension that adds a "File > Hello World" menu item */ 5 | define(function (require, exports, module) { 6 | "use strict"; 7 | var keyBoardShortCutPanel = "Ctrl-Shift-P"; 8 | var keyBoardShortCutModal = "Ctrl-Shift-M"; 9 | var keyBoardShortCutNav = "Ctrl-Shift-N"; 10 | var keyBoardShortCutInputGroup = "Ctrl-Shift-I"; 11 | var keyBoardShortCutHelp = "Ctrl-`"; 12 | var CommandManager = brackets.getModule("command/CommandManager"); 13 | var kbManager = brackets.getModule("command/KeyBindingManager"); 14 | var edManager = brackets.getModule("editor/EditorManager"); 15 | 16 | //append a panel to current editor 17 | function appendPanel(){ 18 | /*jQuery('
', { 19 | id: "foo", 20 | text: "Get into Facebook" 21 | }).appendTo("body");*/ 22 | var panelSeklly = '
\n' + 23 | '
\n' + 24 | '

Panel title

\n' + 25 | '
\n' + 26 | '
\n' + 27 | ' Panel content\n' + 28 | '
\n' + 29 | ' \n' + 30 | '
'; 31 | //window.alert("Hello"); 32 | var editor = edManager.getCurrentFullEditor(); 33 | if(editor){ 34 | var insertionPos = editor.getCursorPos(); 35 | editor.document.replaceRange(panelSeklly, insertionPos); 36 | } 37 | } 38 | //append a modal to the current editor 39 | function appendModal(){ 40 | var panelSeklly = ''; 57 | // window.alert("Hello"); 58 | var editor = edManager.getCurrentFullEditor(); 59 | if(editor){ 60 | var insertionPos = editor.getCursorPos(); 61 | editor.document.replaceRange(panelSeklly, insertionPos); 62 | } 63 | } 64 | 65 | function appendNav(){ 66 | var panelSeklly = ''; 81 | var editor = edManager.getCurrentFullEditor(); 82 | if(editor){ 83 | var insertionPos = editor.getCursorPos(); 84 | editor.document.replaceRange(panelSeklly, insertionPos); 85 | } 86 | } 87 | 88 | function appendInputGroup(){ 89 | var panelSeklly = '
\n' + 90 | ' $\n' + 91 | ' \n' + 92 | ' .00\n' + 93 | '
'; 94 | var editor = edManager.getCurrentFullEditor(); 95 | if(editor){ 96 | var insertionPos = editor.getCursorPos(); 97 | editor.document.replaceRange(panelSeklly, insertionPos); 98 | } 99 | } 100 | 101 | function showHelp(){ 102 | window.alert("Ctrl-Alt-P : Panel\nCtrl-Alt-M: Modal\nCtrl-Alt-I: Input Groups\nCtrl-Alt-N: Navbar"); 103 | } 104 | 105 | var COMMAND_ID_P = "bootstrapsnippets.getPanel"; 106 | var COMMAND_ID_M = "bootstrapsnippets.getModal"; 107 | var COMMAND_ID_N = "bootstrapsnippets.getNav"; 108 | var COMMAND_ID_I = "bootstrapsnippets.getInputGroup"; 109 | var COMMAND_ID_H = "bootstrapsnippets.help"; 110 | 111 | CommandManager.register("Panel", COMMAND_ID_P, appendPanel); 112 | 113 | kbManager.addBinding(COMMAND_ID_P, keyBoardShortCutPanel); 114 | 115 | CommandManager.register("Help", COMMAND_ID_H, showHelp); 116 | 117 | kbManager.addBinding(COMMAND_ID_H, keyBoardShortCutHelp); 118 | 119 | CommandManager.register("Modal", COMMAND_ID_M, appendModal); 120 | 121 | kbManager.addBinding(COMMAND_ID_M, keyBoardShortCutModal); 122 | 123 | CommandManager.register("Nav", COMMAND_ID_N, appendNav); 124 | 125 | kbManager.addBinding(COMMAND_ID_N, keyBoardShortCutNav); 126 | CommandManager.register("InputGroup", COMMAND_ID_I, appendInputGroup); 127 | 128 | kbManager.addBinding(COMMAND_ID_I, keyBoardShortCutInputGroup); 129 | }); 130 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "codeomnitrix.bootstrap-snippets", 3 | "title": "Bootstrap 3 Snippets", 4 | "description": "Add Bootstrap 3 HTML5 Snippets to your page by hitting Ctrl-Shift keys with designated snippets eg. P for panel etc.", 5 | "homepage": "https://github.com/codeomnitrix/bootstrap-snippets", 6 | "version": "0.1.0", 7 | "author": "Vinit Tiwari (https://github.com/codeomnitrix)", 8 | "license": "MIT", 9 | "engines": { 10 | "brackets": ">=0.37.0" 11 | }, 12 | "keywords": [ 13 | "Bootstrap", 14 | "Bootstrap 3", 15 | "Bootstrap Snippets", 16 | "Snippets", 17 | "HTML", 18 | "device", 19 | "screen", 20 | "html", 21 | "HTML Document" 22 | ] 23 | } 24 | --------------------------------------------------------------------------------