editor_plugin_src.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * editor_plugin_src.js
  3. *
  4. * Copyright 2009, Moxiecode Systems AB
  5. * Released under LGPL License.
  6. *
  7. * License: http://tinymce.moxiecode.com/license
  8. * Contributing: http://tinymce.moxiecode.com/contributing
  9. */
  10. (function() {
  11. tinymce.create('tinymce.plugins.Nonbreaking', {
  12. init : function(ed, url) {
  13. var t = this;
  14. t.editor = ed;
  15. // Register commands
  16. ed.addCommand('mceNonBreaking', function() {
  17. ed.execCommand('mceInsertContent', false, (ed.plugins.visualchars && ed.plugins.visualchars.state) ? '<span data-mce-bogus="1" class="mceItemHidden mceItemNbsp">&nbsp;</span>' : '&nbsp;');
  18. });
  19. // Register buttons
  20. ed.addButton('nonbreaking', {title : 'nonbreaking.nonbreaking_desc', cmd : 'mceNonBreaking'});
  21. if (ed.getParam('nonbreaking_force_tab')) {
  22. ed.onKeyDown.add(function(ed, e) {
  23. if (e.keyCode == 9) {
  24. e.preventDefault();
  25. ed.execCommand('mceNonBreaking');
  26. ed.execCommand('mceNonBreaking');
  27. ed.execCommand('mceNonBreaking');
  28. }
  29. });
  30. }
  31. },
  32. getInfo : function() {
  33. return {
  34. longname : 'Nonbreaking space',
  35. author : 'Moxiecode Systems AB',
  36. authorurl : 'http://tinymce.moxiecode.com',
  37. infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking',
  38. version : tinymce.majorVersion + "." + tinymce.minorVersion
  39. };
  40. }
  41. // Private methods
  42. });
  43. // Register plugin
  44. tinymce.PluginManager.add('nonbreaking', tinymce.plugins.Nonbreaking);
  45. })();