includes/clientside/tinymce/plugins/advhr/js/rule.js
changeset 335 67bd3121a12e
child 543 dffcbfbc4e59
equal deleted inserted replaced
334:c72b545f1304 335:67bd3121a12e
       
     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) : '';
       
     7 		f.size.value = dom.getAttrib(n, 'size');
       
     8 		f.noshade.checked = !!dom.getAttrib(n, 'noshade');
       
     9 		selectByValue(f, 'width2', w.indexOf('%') != -1 ? '%' : 'px');
       
    10 	},
       
    11 
       
    12 	update : function() {
       
    13 		var ed = tinyMCEPopup.editor, h, f = document.forms[0];
       
    14 
       
    15 		h = '<hr';
       
    16 
       
    17 		if (f.size.value)
       
    18 			h += ' size="' + f.size.value + '"';
       
    19 
       
    20 		if (f.width.value)
       
    21 			h += ' width="' + f.width.value + (f.width2.value == '%' ? '%' : '') + '"';
       
    22 
       
    23 		if (f.noshade.checked)
       
    24 			h += ' noshade="noshade"';
       
    25 
       
    26 		h += ' />';
       
    27 
       
    28 		ed.execCommand("mceInsertContent", false, h);
       
    29 		tinyMCEPopup.close();
       
    30 	}
       
    31 };
       
    32 
       
    33 tinyMCEPopup.requireLangPack();
       
    34 tinyMCEPopup.onInit.add(AdvHRDialog.init, AdvHRDialog);