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