Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SkinVista committed Oct 10, 2016
1 parent 47c4664 commit 207764d
Show file tree
Hide file tree
Showing 9 changed files with 190 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# brackets-basic-buttons
Basic Buttons Extension for Adobe Brackets
## Instructions
Simply adds Save All, Undo/Redo, and optional Custom button to the toolbar.
Right-click for alternate actions, specify any command for third button.

## History
- 1.0.0 Sept 2016
17 changes: 17 additions & 0 deletions basicbuttons.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#save-button{
background-image: url(save.png);
}
#undo-button{
background-image: url(undo.png);
}
#custom-button{
background-image: url(custom.png);
}
/*
#save-button:hover{
background-position: 0px -24px;
}
#undo-button:hover{
background-position: 0px -24px;
}
*/
Binary file added custom.alt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
94 changes: 94 additions & 0 deletions custom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
const CUSTOM_COMMAND = "change.this";


/*
Right-click the custom command icon to edit this file any time for your convenience.
When saved, go to Debug menu: Reload With Extensions. (or press F5)
See https://github.com/adobe/brackets/blob/master/src/command/Commands.js
Change command text, for example:
CUSTOM_COMMAND = "view.toggleSidebar";
or CUSTOM_COMMAND = "cmd.findAllAndSelect";
or CUSTOM_COMMAND = "navigate.showInOS";
Set text to empty or "none" to hide icon:
CUSTOM_COMMAND = "none";
or CUSTOM_COMMAND = "";
*/


/*
Sample Commands:
"app.reload"
"file.new"
"file.newDoc"
"file.newFile"
"file.newFolder"
"file.openFolder"
"file.open"
"file.save"
"file.saveAll"
"file.saveAs"
"file.close"
"file.close_all"
"file.delete"
"file.rename"
"file.refresh"
"edit.undo"
"edit.redo"
"edit.cut"
"edit.copy"
"edit.paste"
"edit.selectAll"
"edit.selectLine"
"edit.splitSelIntoLines"
"edit.indent"
"edit.unindent"
"edit.duplicate"
"edit.deletelines"
"edit.lineComment"
"edit.blockComment"
"edit.lineUp"
"edit.lineDown"
"edit.findNext"
"edit.findPrevious"
"cmd.find"
"cmd.findInFiles"
"cmd.findNext"
"cmd.findAllAndSelect"
"view.increaseFontSize"
"view.decreaseFontSize"
"view.restoreFontSize"
"view.scrollLineUp"
"view.scrollLineDown"
"view.toggleLineNumbers"
"view.toggleActiveLine"
"view.toggleWordWrap"
"view.toggleSidebar"
"view.hideSidebar"
"view.showSidebar"
"navigate.nextDoc"
"navigate.prevDoc"
"navigate.nextDocListOrder"
"navigate.prevDocListOrder"
"navigate.showInFileTree"
"navigate.showInOS"
"navigate.quickOpen"
"navigate.jumptoDefinition"
"navigate.gotoDefinition"
"navigate.nextMatch"
"navigate.previousMatch"
"file.addToWorkingSet"
"cmd.addToWorkingSetAndOpen"
"cmd.sortWorkingSetByName"
"cmd.sortWorkingSetByType"
"cmd.sortWorkingSetByAdded"
"cmd.splitViewNone"
"cmd.splitViewVertical"
"cmd.splitViewHorizontal"
"cmd.open"
"help.showExtensionsFolder"
See CommandManager.getAll()
*/
Binary file added custom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 61 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/* Brackets Basic-Buttons Extension */

define(function (require, exports, module) {
'use strict';

//console.log("Starting Basic-Buttons Extension");

var ExtensionUtils = brackets.getModule("utils/ExtensionUtils");
var CommandManager = brackets.getModule("command/CommandManager");
var CustomButtom = require("./custom");

ExtensionUtils.loadStyleSheet(module, "basicbuttons.css");

var toolbarSaveButton = $(document.createElement("a"))
.attr("id", "save-button")
.attr("href", "#")
.attr("title", "Save All")
.on("click", function () {
CommandManager.execute("file.saveAll");
})
.on("contextmenu", function () {
CommandManager.execute("file.save");
})
.appendTo($("#main-toolbar .buttons"));

var toolbarUndoButton = $(document.createElement("a"))
.attr("id", "undo-button")
.attr("href", "#")
.attr("title", "Undo/Redo (Right-click)")
.on("click", function () {
CommandManager.execute("edit.undo");
})
.on("contextmenu", function () {
CommandManager.execute("edit.redo");
})
.appendTo($("#main-toolbar .buttons"));

if (CUSTOM_COMMAND && CUSTOM_COMMAND != "none") {

const CustomPath = ExtensionUtils.getModulePath(module) + "custom.js";

var toolbarCustomButton = $(document.createElement("a"))
.attr("id", "custom-button")
.attr("href", "#")
.attr("title", CUSTOM_COMMAND)
.on("click", function () {
if (CUSTOM_COMMAND == "change.this" || CUSTOM_COMMAND.indexOf('.') < 3)
CommandManager.execute("cmd.addToWorkingSetAndOpen", {fullPath: CustomPath});
else
CommandManager.execute(CUSTOM_COMMAND);
})
.on("contextmenu", function () {
CommandManager.execute("cmd.addToWorkingSetAndOpen", {fullPath: CustomPath});
})
.appendTo($("#main-toolbar .buttons"));
//toolbarCustomButton.css("background-position", "0 0");

}

console.log("Loaded Basic-Buttons Extension");
});
12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "basic-buttons",
"title": "Basic Buttons",
"description": "Simply adds Save All, Undo/Redo, and optional Custom button to toolbar. Right-click for alternate action.",
"homepage": "http://github.com/SkinVista/brackets-basic-buttons",
"author": "SkinVista <[email protected]>",
"license": "PPD (Persistent Public Domain)",
"version": "1.0.0",
"engines": {
"brackets": ">=0.20.0"
}
}
Binary file added save.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added undo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 207764d

Please sign in to comment.