Skip to content
This repository has been archived by the owner on May 25, 2019. It is now read-only.

Commit

Permalink
Move toolbar button HTML into separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
Triangle717 committed Sep 12, 2014
1 parent 83120c6 commit 92fb7e7
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# EditorConfig
# EditorConfig.org
root = true

[*]
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
*.tmp
*.bak
*.html
Archives
img
Releases
Expand Down
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 1.3.0 ##
### ?? September, 2014 ###
* Added Splitview compatibility
* Added Split View compatibility
* **_HTML Skeleton_ now requires Brackets 0.44 or newer**
* Properly detect image path relative to document ([#14](https://github.com/le717/brackets-html-skeleton/issues/14))
* Add image shadow for Brackets dark theme
Expand All @@ -12,6 +12,7 @@
* Compress SVG graphics
* Refactor, simplify, improve, and lint much of the code base
* Add meta viewport tag to "Head & Body" and "Full HTML Skeleton" snippets
* Move toolbar button HTML into separate file

## 1.2.2 ##
### 8 August, 2014 ##
Expand Down
1 change: 1 addition & 0 deletions htmlContent/toolbarButton.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a href="#" title="{{DIALOG_TITLE}}" id="html-skeleton-toolbar">
21 changes: 11 additions & 10 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ define(function (require, exports, module) {
SvgSize = require("src/SvgSize"),
Strings = require("strings"),
skeletonLogo = require.toUrl("img/HTML-Skeleton.svg"),
skeletonDialogHtml = require("text!htmlContent/mainDialog.html"),
toolbarButtonCode = "<a href='#' title='{{DIALOG_TITLE}}' id='html-skeleton-toolbar'>";
skeletonDialogHTML = require("text!htmlContent/mainDialog.html"),
toolbarButtonHTML = require("text!htmlContent/toolbarButton.html");

var indentUnits = "",
localizedDialog = Mustache.render(skeletonDialogHtml, Strings);
localizedDialog = Mustache.render(skeletonDialogHTML, Strings),
localizedButton = Mustache.render(toolbarButtonHTML, Strings);

var skeletonBones = [
// Only the head and body tags + title and meta
Expand Down Expand Up @@ -106,7 +107,7 @@ define(function (require, exports, module) {
* Insert the selected elements into the document
* @param elements The elements to be inserted into the document
*/
function _insertAllTheCodes(elements) {
function _insertSelectedElements(elements) {
// Get the document in the full editor
var editor = EditorManager.getCurrentFullEditor();

Expand Down Expand Up @@ -180,8 +181,8 @@ define(function (require, exports, module) {
finalElements.push(imageCodeFill);
}

// Finally, run process to add the selected elements
_insertAllTheCodes(finalElements);
// Finally, add the selected elements to the document
_insertSelectedElements(finalElements);
}


Expand Down Expand Up @@ -347,7 +348,7 @@ define(function (require, exports, module) {
* @private
* Display HTML Skeleton dialog box
*/
function _handleSkeletonButton() {
function _displaySkeletonDialog() {
var skeletonDialog = Dialogs.showModalDialogUsingTemplate(localizedDialog),
$dialog = skeletonDialog.getElement(),
$doneButton = $(".dialog-button[data-button-id='ok']", $dialog);
Expand Down Expand Up @@ -380,12 +381,12 @@ define(function (require, exports, module) {
ExtensionUtils.loadStyleSheet(module, "css/style.css");

// Create a menu item in the Edit menu
CommandManager.register(Strings.INSERT_HTML_ELEMENTS, EXTENSION_ID, _handleSkeletonButton);
CommandManager.register(Strings.INSERT_HTML_ELEMENTS, EXTENSION_ID, _displaySkeletonDialog);
var menu = Menus.getMenu(Menus.AppMenuBar.EDIT_MENU);
menu.addMenuItem(EXTENSION_ID);

// Create toolbar icon
$(Mustache.render(toolbarButtonCode, Strings)).appendTo("#main-toolbar > .buttons")
.on("click", _handleSkeletonButton);
$(localizedButton).appendTo("#main-toolbar > .buttons")
.on("click", _displaySkeletonDialog);
});
});

0 comments on commit 92fb7e7

Please sign in to comment.