Created
August 20, 2014 12:24
-
-
Save alej0varas/41ccc547ec25bde921f6 to your computer and use it in GitHub Desktop.
hallo.js font size plugin
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
// Hallo font size plugin | |
// Shows 7 buttons with an A + the size number. | |
// https://developer.mozilla.org/en-US/docs/Web/API/document.execCommand | |
// fontSize | |
// Changes the font size for the selection or at the insertion point. This requires an HTML font size (1-7) to be passed in as a // value argument. | |
// | |
// (c) 2014 Alejandro Varas | |
// hallofontsize may be freely distributed under the MIT license | |
(function(jQuery) { | |
return jQuery.widget("IKS.hallofontsize", { | |
colorElement : null, | |
options: { | |
uuid: '', | |
}, | |
editable: null, | |
populateToolbar: function(toolbar) { | |
var buttonize, buttonset, _this = this; | |
buttonset = jQuery("<span class=\"" + this.widgetName + "\"></span>"); | |
buttonize = function(alignment, command, size) { | |
var buttonElement; | |
buttonElement = jQuery('<span></span>'); | |
buttonElement.hallobutton({ | |
uuid: _this.options.uuid, | |
editable: _this.options.editable, | |
label: alignment, | |
command: command, | |
commandValue: size, | |
cssClass: _this.options.buttonCssClass | |
}); | |
// overrides button font | |
buttonElement.find('.ui-button-text').text('A' + size); | |
return buttonset.append(buttonElement); | |
}; | |
buttonize("Font 1", "fontSize", 1); | |
buttonize("Font 2", "fontSize", 2); | |
buttonize("Font 3", "fontSize", 3); | |
buttonize("Font 4", "fontSize", 4); | |
buttonize("Font 5", "fontSize", 5); | |
buttonize("Font 6", "fontSize", 6); | |
buttonize("Font 7", "fontSize", 7); | |
buttonset.hallobuttonset(); | |
return toolbar.append(buttonset); | |
} | |
}); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment