Nicolas Bally 120e9803eb initial
2020-04-28 14:51:42 +02:00

34 lines
835 B
JavaScript
Executable File

(function($)
{
$.Redactor.prototype.fontfamily = function()
{
return {
init: function ()
{
var fonts = [ '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', 'Font');
this.button.setIcon(button, '<i class="re-icon-fontfamily"></i>');
this.button.addDropdown(button, dropdown);
},
set: function (value)
{
this.inline.format('span', 'style', 'font-family:' + value + ';');
},
reset: function()
{
this.inline.removeStyleRule('font-family');
}
};
};
})(jQuery);