1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/**
* editor_plugin_src.js
*
* Copyright 2012, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
tinymce.create('tinymce.plugins.VisualBlocks', {
init : function(ed, url) {
var cssId;
// We don't support older browsers like IE6/7 and they don't provide prototypes for DOM objects
if (!window.NodeList) {
return;
}
ed.addCommand('mceVisualBlocks', function() {
var dom = ed.dom, linkElm;
if (!cssId) {
cssId = dom.uniqueId();
linkElm = dom.create('link', {
id: cssId,
rel : 'stylesheet',
href : url + '/css/visualblocks.css'
});
ed.getDoc().getElementsByTagName('head')[0].appendChild(linkElm);
} else {
linkElm = dom.get(cssId);
linkElm.disabled = !linkElm.disabled;
}
ed.controlManager.setActive('visualblocks', !linkElm.disabled);
});
ed.addButton('visualblocks', {title : 'visualblocks.desc', cmd : 'mceVisualBlocks'});
ed.onInit.add(function() {
if (ed.settings.visualblocks_default_state) {
ed.execCommand('mceVisualBlocks');
}
});
},
getInfo : function() {
return {
longname : 'Visual blocks',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualblocks',
version : tinymce.majorVersion + "." + tinymce.minorVersion
};
}
});
// Register plugin
tinymce.PluginManager.add('visualblocks', tinymce.plugins.VisualBlocks);
})();
|