~quam-plures-core/quam-plures/bug-614012

« back to all changes in this revision

Viewing changes to qp_plugins/tinymce_plugin/tiny_mce/plugins/advhr/js/rule.js

  • Committer: yabs
  • Author(s): EdB
  • Date: 2010-07-23 07:41:42 UTC
  • mfrom: (7507.5.4 upgrade_tinymce_core)
  • Revision ID: yabs@innervisions.org.uk-20100723074142-1xhibhdhaibhq33m
Upgrade TinyMCE

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
var AdvHRDialog = {
 
2
        init : function(ed) {
 
3
                var dom = ed.dom, f = document.forms[0], n = ed.selection.getNode(), w;
 
4
 
 
5
                w = dom.getAttrib(n, 'width');
 
6
                f.width.value = w ? parseInt(w) : (dom.getStyle('width') || '');
 
7
                f.size.value = dom.getAttrib(n, 'size') || parseInt(dom.getStyle('height')) || '';
 
8
                f.noshade.checked = !!dom.getAttrib(n, 'noshade') || !!dom.getStyle('border-width');
 
9
                selectByValue(f, 'width2', w.indexOf('%') != -1 ? '%' : 'px');
 
10
        },
 
11
 
 
12
        update : function() {
 
13
                var ed = tinyMCEPopup.editor, h, f = document.forms[0], st = '';
 
14
 
 
15
                h = '<hr';
 
16
 
 
17
                if (f.size.value) {
 
18
                        h += ' size="' + f.size.value + '"';
 
19
                        st += ' height:' + f.size.value + 'px;';
 
20
                }
 
21
 
 
22
                if (f.width.value) {
 
23
                        h += ' width="' + f.width.value + (f.width2.value == '%' ? '%' : '') + '"';
 
24
                        st += ' width:' + f.width.value + (f.width2.value == '%' ? '%' : 'px') + ';';
 
25
                }
 
26
 
 
27
                if (f.noshade.checked) {
 
28
                        h += ' noshade="noshade"';
 
29
                        st += ' border-width: 1px; border-style: solid; border-color: #CCCCCC; color: #ffffff;';
 
30
                }
 
31
 
 
32
                if (ed.settings.inline_styles)
 
33
                        h += ' style="' + tinymce.trim(st) + '"';
 
34
 
 
35
                h += ' />';
 
36
 
 
37
                ed.execCommand("mceInsertContent", false, h);
 
38
                tinyMCEPopup.close();
 
39
        }
 
40
};
 
41
 
 
42
tinyMCEPopup.requireLangPack();
 
43
tinyMCEPopup.onInit.add(AdvHRDialog.init, AdvHRDialog);