fontfamily.js 778 B

123456789101112131415161718192021222324252627282930313233
  1. (function($)
  2. {
  3. $.Redactor.prototype.fontfamily = function()
  4. {
  5. return {
  6. init: function ()
  7. {
  8. var fonts = [ 'Arial', 'Helvetica', 'Georgia', 'Times New Roman', 'Monospace' ];
  9. var that = this;
  10. var dropdown = {};
  11. $.each(fonts, function(i, s)
  12. {
  13. dropdown['s' + i] = { title: s, func: function() { that.fontfamily.set(s); }};
  14. });
  15. dropdown.remove = { title: 'Remove Font Family', func: that.fontfamily.reset };
  16. var button = this.button.add('fontfamily', 'Change Font Family');
  17. this.button.addDropdown(button, dropdown);
  18. },
  19. set: function (value)
  20. {
  21. this.inline.format('span', 'style', 'font-family:' + value + ';');
  22. },
  23. reset: function()
  24. {
  25. this.inline.removeStyleRule('font-family');
  26. }
  27. };
  28. };
  29. })(jQuery);