includes/clientside/tinymce/plugins/table/js/table.js
changeset 543 dffcbfbc4e59
parent 395 fa4c5ecb7c9a
child 588 20484deb89cd
--- a/includes/clientside/tinymce/plugins/table/js/table.js	Mon May 05 20:06:37 2008 -0400
+++ b/includes/clientside/tinymce/plugins/table/js/table.js	Mon May 05 20:08:44 2008 -0400
@@ -9,6 +9,8 @@
 	var html = '', capEl, elm;
 	var cellLimit, rowLimit, colLimit;
 
+	tinyMCEPopup.restoreSelection();
+
 	if (!AutoValidator.validate(formObj)) {
 		alert(inst.getLang('invalid_data'));
 		return false;
@@ -85,13 +87,23 @@
 			elm.insertBefore(capEl, elm.firstChild);
 		}
 
-		dom.setAttrib(elm, 'width', width, true);
+		if (width && /(pt|em|cm)$/.test(width)) {
+			dom.setStyle(elm, 'width', width);
+			dom.setAttrib(elm, 'width', '');
+		} else {
+			dom.setAttrib(elm, 'width', width, true);
+			dom.setStyle(elm, 'width', '');
+		}
 
 		// Remove these since they are not valid XHTML
 		dom.setAttrib(elm, 'borderColor', '');
 		dom.setAttrib(elm, 'bgColor', '');
 		dom.setAttrib(elm, 'background', '');
-		dom.setAttrib(elm, 'height', '');
+
+		if (height) {
+			dom.setStyle(elm, 'height', height);
+			dom.setAttrib(elm, 'height', '');
+		}
 
 		if (background != '')
 			elm.style.backgroundImage = "url('" + background + "')";
@@ -136,7 +148,22 @@
 	html += makeAttrib('border', border);
 	html += makeAttrib('cellpadding', cellpadding);
 	html += makeAttrib('cellspacing', cellspacing);
-	html += makeAttrib('width', width);
+
+	if (width && /(pt|em|cm)$/.test(width)) {
+		if (style)
+			style += '; ';
+
+		style += 'width: ' + width;
+	} else
+		html += makeAttrib('width', width);
+
+/*	if (height) {
+		if (style)
+			style += '; ';
+
+		style += 'height: ' + height;
+	}*/
+
 	//html += makeAttrib('height', height);
 	//html += makeAttrib('bordercolor', bordercolor);
 	//html += makeAttrib('bgcolor', bgcolor);
@@ -261,12 +288,13 @@
 	}
 
 	addClassesToList('class', "table_styles");
+	TinyMCE_EditableSelects.init();
 
 	// Update form
 	selectByValue(formObj, 'align', align);
 	selectByValue(formObj, 'frame', frame);
 	selectByValue(formObj, 'rules', rules);
-	selectByValue(formObj, 'class', className);
+	selectByValue(formObj, 'class', className, true, true);
 	formObj.cols.value = cols;
 	formObj.rows.value = rows;
 	formObj.border.value = border;