Nicolas Bally 8a08ee35c8 initial
2015-02-22 14:36:30 +01:00

32 lines
790 B
JavaScript
Executable File

if (!RedactorPlugins) var RedactorPlugins = {};
RedactorPlugins.fontfamily = function()
{
return {
init: function ()
{
var fonts = [ 'Lato', 'Stylograph','Arial', 'Helvetica', 'Georgia', 'Times New Roman', 'Monospace' ];
var that = this;
var dropdown = {};
$.each(fonts, function(i, s)
{
dropdown['s' + i] = { title: s, func: function() { that.fontfamily.set(s); }};
});
dropdown.remove = { title: 'Remove Font Family', func: that.fontfamily.reset };
var button = this.button.add('fontfamily', 'Change Font Family');
this.button.addDropdown(button, dropdown);
},
set: function (value)
{
this.inline.format('span', 'style', 'font-family:' + value + ';');
},
reset: function()
{
this.inline.removeStyleRule('font-family');
}
};
};