Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0078196
Showing
7 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */ | ||
/*global define, $, brackets, window, Mustache */ | ||
|
||
define(function (require, exports, module) { | ||
"use strict"; | ||
|
||
var CommandManager = brackets.getModule("command/CommandManager"), | ||
ExtensionUtils = brackets.getModule("utils/ExtensionUtils"), | ||
Menus = brackets.getModule("command/Menus"), | ||
Strings = require("strings"), | ||
ModalBar = brackets.getModule("widgets/ModalBar").ModalBar; | ||
|
||
var _markdownBarTemplate = require("text!templates/markdown-bar.html"); | ||
|
||
var toolBar = null; | ||
var cmdToolbar = null; | ||
|
||
function toggleBar() { | ||
if (toolBar) { | ||
toolBar.close(); | ||
toolBar = null; | ||
cmdToolbar.setChecked(false); | ||
} else { | ||
var templateVars = {}; | ||
templateVars.Strings = Strings; | ||
toolBar = new ModalBar(Mustache.render(_markdownBarTemplate, templateVars), false); | ||
cmdToolbar.setChecked(true); | ||
} | ||
} | ||
|
||
var BAR_COMMAND_ID = "alanhohn.togglemarkdownbar"; | ||
cmdToolbar = CommandManager.register("Markdown Toolbar", BAR_COMMAND_ID, toggleBar); | ||
|
||
var menu = Menus.getMenu(Menus.AppMenuBar.VIEW_MENU); | ||
menu.addMenuItem(BAR_COMMAND_ID, "Ctrl-Shift-T"); | ||
|
||
ExtensionUtils.loadStyleSheet(module, "styles/styles.css"); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */ | ||
/*global define */ | ||
|
||
define({ | ||
"BUTTON_H1" : "H1", | ||
"BUTTON_H2" : "H2", | ||
"BUTTON_H3" : "H3", | ||
"BUTTON_BOLD" : "B", | ||
"BUTTON_ITALIC" : "I", | ||
"BUTTON_STRIKETHROUGH" : "S" | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */ | ||
/*global define */ | ||
|
||
define(function (require, exports, module) { | ||
|
||
"use strict"; | ||
|
||
module.exports = { | ||
root: true | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "alanhohn.markdown-toolbar", | ||
"title": "Markdown Toolbar", | ||
"description": "Provides a toolbar to help write documents in Markdown.", | ||
"homepage": "https://github.com/alanhohn/marktool-toolbar", | ||
"version": "1.0.0", | ||
"author": "Alan Hohn <alanhohn@gmail.com> (http://github.com/alanhohn)", | ||
"license": "MIT", | ||
"engines": { | ||
"brackets": ">=0.24.0" | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */ | ||
/*global define */ | ||
|
||
define(function (require, exports, module) { | ||
"use strict"; | ||
|
||
module.exports = require("i18n!nls/strings"); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
.alanhohn-markdown-bar #markdown-heading1 | ||
{ | ||
font-weight: bolder; | ||
} | ||
|
||
.alanhohn-markdown-bar #markdown-heading2 | ||
{ | ||
color: dimgray; | ||
font-weight: bold; | ||
} | ||
|
||
.alanhohn-markdown-bar #markdown-heading3 | ||
{ | ||
color: darkgray; | ||
} | ||
|
||
.alanhohn-markdown-bar #markdown-bold | ||
{ | ||
font-weight: bolder; | ||
} | ||
|
||
.alanhohn-markdown-bar #markdown-italic | ||
{ | ||
font-style: italic; | ||
} | ||
|
||
.alanhohn-markdown-bar #markdown-strikethrough | ||
{ | ||
text-decoration: line-through; | ||
} | ||
|
||
.alanhohn-markdown-bar .spacer | ||
{ | ||
width: 2em; | ||
height: auto; | ||
display: inline-block; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<div class="alanhohn-markdown-bar"> | ||
<div id="markdown-button-bar"> | ||
<button id="markdown-heading1" class="btn no-focus" tabindex="-1">{{Strings.BUTTON_H1}}</button> | ||
<button id="markdown-heading2" class="btn no-focus" tabindex="-1">{{Strings.BUTTON_H2}}</button> | ||
<button id="markdown-heading3" class="btn no-focus" tabindex="-1">{{Strings.BUTTON_H3}}</button> | ||
<div class="spacer"></div> | ||
<button id="markdown-bold" class="btn no-focus" tabindex="-1">{{Strings.BUTTON_BOLD}}</button> | ||
<button id="markdown-italic" class="btn no-focus" tabindex="-1">{{Strings.BUTTON_ITALIC}}</button> | ||
<button id="markdown-strikethrough" class="btn no-focus" tabindex="-1">{{Strings.BUTTON_STRIKETHROUGH}}</button> | ||
</div> | ||
</div> |