fontsize.js 741 B

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