~ubuntu-branches/ubuntu/utopic/moodle/utopic

« back to all changes in this revision

Viewing changes to lib/editor/tinymce/tiny_mce/3.5.10/plugins/visualblocks/editor_plugin_src.js

  • Committer: Package Import Robot
  • Author(s): Thijs Kinkhorst
  • Date: 2014-05-12 16:10:38 UTC
  • mfrom: (36.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20140512161038-puyqf65k4e0s8ytz
Tags: 2.6.3-1
New upstream release.

Show diffs side-by-side

added added

removed removed

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