includes/clientside/tinymce/plugins/advhr/js/rule.js
changeset 1344 dc96d6c5cd1e
parent 1343 2a31905a567d
child 1345 1de01205143b
equal deleted inserted replaced
1343:2a31905a567d 1344:dc96d6c5cd1e
     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);