/static/scripts/tiny_mce/plugins/nonbreaking/editor_plugin_src.js

http://n23.googlecode.com/ · JavaScript · 50 lines · 32 code · 8 blank · 10 comment · 5 complexity · 9798028106d455b95a9d97e062861535 MD5 · raw file

  1. /**
  2. * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
  3. *
  4. * @author Moxiecode
  5. * @copyright Copyright Š 2004-2008, Moxiecode Systems AB, All rights reserved.
  6. */
  7. (function() {
  8. tinymce.create('tinymce.plugins.Nonbreaking', {
  9. init : function(ed, url) {
  10. var t = this;
  11. t.editor = ed;
  12. // Register commands
  13. ed.addCommand('mceNonBreaking', function() {
  14. ed.execCommand('mceInsertContent', false, (ed.plugins.visualchars && ed.plugins.visualchars.state) ? '<span class="mceItemHidden mceVisualNbsp">&middot;</span>' : '&nbsp;');
  15. });
  16. // Register buttons
  17. ed.addButton('nonbreaking', {title : 'nonbreaking.nonbreaking_desc', cmd : 'mceNonBreaking'});
  18. if (ed.getParam('nonbreaking_force_tab')) {
  19. ed.onKeyDown.add(function(ed, e) {
  20. if (tinymce.isIE && e.keyCode == 9) {
  21. ed.execCommand('mceNonBreaking');
  22. ed.execCommand('mceNonBreaking');
  23. ed.execCommand('mceNonBreaking');
  24. tinymce.dom.Event.cancel(e);
  25. }
  26. });
  27. }
  28. },
  29. getInfo : function() {
  30. return {
  31. longname : 'Nonbreaking space',
  32. author : 'Moxiecode Systems AB',
  33. authorurl : 'http://tinymce.moxiecode.com',
  34. infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking',
  35. version : tinymce.majorVersion + "." + tinymce.minorVersion
  36. };
  37. }
  38. // Private methods
  39. });
  40. // Register plugin
  41. tinymce.PluginManager.add('nonbreaking', tinymce.plugins.Nonbreaking);
  42. })();