| 1 |
lars |
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"> </span>' : ' ');
|
|
|
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 (e.keyCode == 9) {
|
|
|
29 |
e.preventDefault();
|
|
|
30 |
|
|
|
31 |
ed.execCommand('mceNonBreaking');
|
|
|
32 |
ed.execCommand('mceNonBreaking');
|
|
|
33 |
ed.execCommand('mceNonBreaking');
|
|
|
34 |
}
|
|
|
35 |
});
|
|
|
36 |
}
|
|
|
37 |
},
|
|
|
38 |
|
|
|
39 |
getInfo : function() {
|
|
|
40 |
return {
|
|
|
41 |
longname : 'Nonbreaking space',
|
|
|
42 |
author : 'Moxiecode Systems AB',
|
|
|
43 |
authorurl : 'http://tinymce.moxiecode.com',
|
|
|
44 |
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking',
|
|
|
45 |
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
|
|
46 |
};
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
// Private methods
|
|
|
50 |
});
|
|
|
51 |
|
|
|
52 |
// Register plugin
|
|
|
53 |
tinymce.PluginManager.add('nonbreaking', tinymce.plugins.Nonbreaking);
|
|
|
54 |
})();
|