includes/clientside/tinymce/plugins/table/js/row.js
changeset 543 dffcbfbc4e59
parent 395 fa4c5ecb7c9a
--- a/includes/clientside/tinymce/plugins/table/js/row.js	Mon May 05 20:06:37 2008 -0400
+++ b/includes/clientside/tinymce/plugins/table/js/row.js	Mon May 05 20:08:44 2008 -0400
@@ -26,6 +26,8 @@
 
 	// Setup form
 	addClassesToList('class', 'table_row_styles');
+	TinyMCE_EditableSelects.init();
+
 	formObj.bgcolor.value = bgcolor;
 	formObj.backgroundimage.value = backgroundimage;
 	formObj.height.value = height;
@@ -34,7 +36,7 @@
 	formObj.style.value = dom.serializeStyle(st);
 	selectByValue(formObj, 'align', align);
 	selectByValue(formObj, 'valign', valign);
-	selectByValue(formObj, 'class', className);
+	selectByValue(formObj, 'class', className, true, true);
 	selectByValue(formObj, 'rowtype', rowtype);
 	selectByValue(formObj, 'dir', dir);
 
@@ -46,13 +48,13 @@
 }
 
 function updateAction() {
-	var inst = tinyMCEPopup.editor;
-	var dom = inst.dom;
-	var trElm = dom.getParent(inst.selection.getNode(), "tr");
-	var tableElm = dom.getParent(inst.selection.getNode(), "table");
-	var formObj = document.forms[0];
+	var inst = tinyMCEPopup.editor, dom = inst.dom, trElm, tableElm, formObj = document.forms[0];
 	var action = getSelectValue(formObj, 'action');
 
+	tinyMCEPopup.restoreSelection();
+	trElm = dom.getParent(inst.selection.getNode(), "tr");
+	tableElm = dom.getParent(inst.selection.getNode(), "table");
+
 	inst.execCommand('mceBeginUndoLevel');
 
 	switch (action) {
@@ -136,9 +138,12 @@
 		if (newParent == null) {
 			newParent = doc.createElement(dest);
 
-			if (dest == "thead")
-				theTable.insertBefore(newParent, theTable.firstChild);
-			else
+			if (dest == "thead") {
+				if (theTable.firstChild.nodeName == 'CAPTION')
+					inst.dom.insertAfter(newParent, theTable.firstChild);
+				else
+					theTable.insertBefore(newParent, theTable.firstChild);
+			} else
 				theTable.appendChild(newParent);
 		}