home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Plugins / tinymce-advanced / mce / nonbreaking / editor_plugin.js
Encoding:
Text File  |  2008-02-20  |  2.0 KB  |  69 lines

  1. /**
  2.  * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
  3.  *
  4.  * @author Moxiecode
  5.  * @copyright Copyright ⌐ 2004-2007, Moxiecode Systems AB, All rights reserved.
  6.  */
  7.  
  8. // UK lang variables
  9. tadvmce = realTinyMCE;
  10. tadvmce.addToLang('nonbreaking',{
  11. desc : 'Insert non-breaking space character'
  12. });
  13.  
  14. /* Import plugin specific language pack */
  15. //tinyMCE.importPluginLanguagePack('nonbreaking');
  16.  
  17. var TinyMCE_NonBreakingPlugin = {
  18.     getInfo : function() {
  19.         return {
  20.             longname : 'Nonbreaking space',
  21.             author : 'Moxiecode Systems AB',
  22.             authorurl : 'http://tinymce.moxiecode.com',
  23.             infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking',
  24.             version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
  25.         };
  26.     },
  27.  
  28.     getControlHTML : function(cn) {
  29.         switch (cn) {
  30.             case "nonbreaking":
  31.                 return tinyMCE.getButtonHTML(cn, 'lang_nonbreaking_desc', '{$pluginurl}/images/nonbreaking.gif', 'mceNonBreaking', false);
  32.         }
  33.  
  34.         return "";
  35.     },
  36.  
  37.  
  38.     execCommand : function(editor_id, element, command, user_interface, value) {
  39.         var inst = tinyMCE.getInstanceById(editor_id), h;
  40.  
  41.         switch (command) {
  42.             case "mceNonBreaking":
  43.                 h = (inst.visualChars && inst.visualChars.state) ? '<span class="mceItemHiddenVisualChar">·</span>' : ' ';
  44.                 tinyMCE.execInstanceCommand(editor_id, 'mceInsertContent', false, h);
  45.                 return true;
  46.         }
  47.  
  48.         return false;
  49.     },
  50.  
  51.     handleEvent : function(e) {
  52.         var inst, h;
  53.  
  54.         if (!tinyMCE.isOpera && e.type == 'keydown' && e.keyCode == 9 && tinyMCE.getParam('nonbreaking_force_tab', false)) {
  55.             inst = tinyMCE.selectedInstance;
  56.  
  57.             h = (inst.visualChars && inst.visualChars.state) ? '<span class="mceItemHiddenVisualChar">···</span>' : '   ';
  58.             tinyMCE.execInstanceCommand(inst.editorId, 'mceInsertContent', false, h);
  59.  
  60.             tinyMCE.cancelEvent(e);
  61.             return false;
  62.         }
  63.  
  64.         return true;
  65.     }
  66. };
  67.  
  68. tinyMCE.addPlugin("nonbreaking", TinyMCE_NonBreakingPlugin);
  69.