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

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Thijs Kinkhorst
  • Date: 2014-05-12 16:10:38 UTC
  • mfrom: (1.1.16)
  • Revision ID: package-import@ubuntu.com-20140512161038-2039l24hvvlan3hs
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 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.StylePlugin', {
 
13
                init : function(ed, url) {
 
14
                        // Register commands
 
15
                        ed.addCommand('mceStyleProps', function() {
 
16
 
 
17
                                var applyStyleToBlocks = false;
 
18
                                var blocks = ed.selection.getSelectedBlocks();
 
19
                                var styles = [];
 
20
 
 
21
                                if (blocks.length === 1) {
 
22
                                        styles.push(ed.selection.getNode().style.cssText);
 
23
                                }
 
24
                                else {
 
25
                                        tinymce.each(blocks, function(block) {
 
26
                                                styles.push(ed.dom.getAttrib(block, 'style'));
 
27
                                        });
 
28
                                        applyStyleToBlocks = true;
 
29
                                }
 
30
 
 
31
                                ed.windowManager.open({
 
32
                                        file : url + '/props.htm',
 
33
                                        width : 480 + parseInt(ed.getLang('style.delta_width', 0)),
 
34
                                        height : 340 + parseInt(ed.getLang('style.delta_height', 0)),
 
35
                                        inline : 1
 
36
                                }, {
 
37
                                        applyStyleToBlocks : applyStyleToBlocks,
 
38
                                        plugin_url : url,
 
39
                                        styles : styles
 
40
                                });
 
41
                        });
 
42
 
 
43
                        ed.addCommand('mceSetElementStyle', function(ui, v) {
 
44
                                if (e = ed.selection.getNode()) {
 
45
                                        ed.dom.setAttrib(e, 'style', v);
 
46
                                        ed.execCommand('mceRepaint');
 
47
                                }
 
48
                        });
 
49
 
 
50
                        ed.onNodeChange.add(function(ed, cm, n) {
 
51
                                cm.setDisabled('styleprops', n.nodeName === 'BODY');
 
52
                        });
 
53
 
 
54
                        // Register buttons
 
55
                        ed.addButton('styleprops', {title : 'style.desc', cmd : 'mceStyleProps'});
 
56
                },
 
57
 
 
58
                getInfo : function() {
 
59
                        return {
 
60
                                longname : 'Style',
 
61
                                author : 'Moxiecode Systems AB',
 
62
                                authorurl : 'http://tinymce.moxiecode.com',
 
63
                                infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',
 
64
                                version : tinymce.majorVersion + "." + tinymce.minorVersion
 
65
                        };
 
66
                }
 
67
        });
 
68
 
 
69
        // Register plugin
 
70
        tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin);
 
71
})();