]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/javascript/tiny_mce/plugins/nonbreaking/editor_plugin_src.js
Release 6.5.0
[Github/sugarcrm.git] / include / javascript / tiny_mce / plugins / nonbreaking / editor_plugin_src.js
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
11 (function() {
12         tinymce.create('tinymce.plugins.Nonbreaking', {
13                 init : function(ed, url) {
14                         var t = this;
15
16                         t.editor = ed;
17
18                         // Register commands
19                         ed.addCommand('mceNonBreaking', function() {
20                                 ed.execCommand('mceInsertContent', false, (ed.plugins.visualchars && ed.plugins.visualchars.state) ? '<span data-mce-bogus="1" class="mceItemHidden mceItemNbsp">&nbsp;</span>' : '&nbsp;');
21                         });
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                         };
46                 }
47
48                 // Private methods
49         });
50
51         // Register plugin
52         tinymce.PluginManager.add('nonbreaking', tinymce.plugins.Nonbreaking);
53 })();