Skip to content

Commit

Permalink
Module loading, more customizable icone
Browse files Browse the repository at this point in the history
  • Loading branch information
connor4312 committed Dec 2, 2014
1 parent 9fb3a34 commit 4055dc3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "redimage",
"main": "redimage.js",
"version": "0.0.1",
"version": "0.0.2",
"homepage": "https://github.com/MCProHosting/redimage",
"authors": [
"Connor Peet <[email protected]>"
Expand Down
26 changes: 21 additions & 5 deletions redimage.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,20 @@
return plugins.redimage;
};

/**
* The button HTML to use.
* @return {[type]} [description]
*/
plugins.redimage.buttonHtml = function () {
return '<i class="fa fa-photo"></i>';
};

/**
* Returns the template string for the modal popup.
*
* @return {String}
*/
plugins.redimage.getTemplate = function() {
plugins.redimage.getTemplate = function () {
return String() +
'<section id="redactor-modal-redimage-insert">' +
'<label>Link to Image</label>' +
Expand All @@ -32,9 +40,10 @@
* Initialises the plugin, adding its image to the Redactor toolbar.
*/
plugins.redimage.init = function () {
var button = this.button.add('redimage-btn', 'Link Image');
this.button.setAwesome('redimage-btn', 'fa-photo');
this.button.addCallback(button, this.redimage.show);
var $button = this.button.add('redimage-btn', 'Link Image');
$button.html(plugins.redimage.buttonHtml());

this.button.addCallback($button, this.redimage.show);
};

/**
Expand Down Expand Up @@ -94,4 +103,11 @@
return str.replace(/[&<>"'"]/g, escapeHtmlChar);
}

}).call(this);
// Expose for module loading
if (typeof define === "function" && define.amd) {
define(plugins.redimage);
} else if (typeof module === "object" && module.exports) {
module.exports = plugins.redimage;
}

}).call(window);

0 comments on commit 4055dc3

Please sign in to comment.