textdirection.js 640 B

1234567891011121314151617181920212223242526272829
  1. (function($)
  2. {
  3. $.Redactor.prototype.textdirection = function()
  4. {
  5. return {
  6. init: function()
  7. {
  8. var that = this;
  9. var dropdown = {};
  10. dropdown.ltr = { title: 'Left to Right', func: that.textdirection.setLtr };
  11. dropdown.rtl = { title: 'Right to Left', func: that.textdirection.setRtl};
  12. var button = this.button.add('textdirection', 'Change Text Direction');
  13. this.button.addDropdown(button, dropdown);
  14. },
  15. setRtl: function()
  16. {
  17. this.buffer.set();
  18. this.block.setAttr('dir', 'rtl');
  19. },
  20. setLtr: function()
  21. {
  22. this.buffer.set();
  23. this.block.removeAttr('dir');
  24. }
  25. };
  26. };
  27. })(jQuery);