includes/clientside/tinymce/plugins/advhr/js/rule.js
changeset 543 dffcbfbc4e59
parent 335 67bd3121a12e
equal deleted inserted replaced
542:5841df0ab575 543:dffcbfbc4e59
     1 var AdvHRDialog = {
     1 var AdvHRDialog = {
     2 	init : function(ed) {
     2 	init : function(ed) {
     3 		var dom = ed.dom, f = document.forms[0], n = ed.selection.getNode(), w;
     3 		var dom = ed.dom, f = document.forms[0], n = ed.selection.getNode(), w;
     4 
     4 
     5 		w = dom.getAttrib(n, 'width');
     5 		w = dom.getAttrib(n, 'width');
     6 		f.width.value = w ? parseInt(w) : '';
     6 		f.width.value = w ? parseInt(w) : (dom.getStyle('width') || '');
     7 		f.size.value = dom.getAttrib(n, 'size');
     7 		f.size.value = dom.getAttrib(n, 'size') || parseInt(dom.getStyle('height')) || '';
     8 		f.noshade.checked = !!dom.getAttrib(n, 'noshade');
     8 		f.noshade.checked = !!dom.getAttrib(n, 'noshade') || !!dom.getStyle('border-width');
     9 		selectByValue(f, 'width2', w.indexOf('%') != -1 ? '%' : 'px');
     9 		selectByValue(f, 'width2', w.indexOf('%') != -1 ? '%' : 'px');
    10 	},
    10 	},
    11 
    11 
    12 	update : function() {
    12 	update : function() {
    13 		var ed = tinyMCEPopup.editor, h, f = document.forms[0];
    13 		var ed = tinyMCEPopup.editor, h, f = document.forms[0], st = '';
    14 
    14 
    15 		h = '<hr';
    15 		h = '<hr';
    16 
    16 
    17 		if (f.size.value)
    17 		if (f.size.value) {
    18 			h += ' size="' + f.size.value + '"';
    18 			h += ' size="' + f.size.value + '"';
       
    19 			st += ' height:' + f.size.value + 'px;';
       
    20 		}
    19 
    21 
    20 		if (f.width.value)
    22 		if (f.width.value) {
    21 			h += ' width="' + f.width.value + (f.width2.value == '%' ? '%' : '') + '"';
    23 			h += ' width="' + f.width.value + (f.width2.value == '%' ? '%' : '') + '"';
       
    24 			st += ' width:' + f.width.value + (f.width2.value == '%' ? '%' : 'px') + ';';
       
    25 		}
    22 
    26 
    23 		if (f.noshade.checked)
    27 		if (f.noshade.checked) {
    24 			h += ' noshade="noshade"';
    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) + '"';
    25 
    34 
    26 		h += ' />';
    35 		h += ' />';
    27 
    36 
    28 		ed.execCommand("mceInsertContent", false, h);
    37 		ed.execCommand("mceInsertContent", false, h);
    29 		tinyMCEPopup.close();
    38 		tinyMCEPopup.close();