includes/clientside/tinymce/plugins/table/js/row.js
changeset 543 dffcbfbc4e59
parent 395 fa4c5ecb7c9a
equal deleted inserted replaced
542:5841df0ab575 543:dffcbfbc4e59
    24 	var lang = dom.getAttrib(trElm, 'lang');
    24 	var lang = dom.getAttrib(trElm, 'lang');
    25 	var dir = dom.getAttrib(trElm, 'dir');
    25 	var dir = dom.getAttrib(trElm, 'dir');
    26 
    26 
    27 	// Setup form
    27 	// Setup form
    28 	addClassesToList('class', 'table_row_styles');
    28 	addClassesToList('class', 'table_row_styles');
       
    29 	TinyMCE_EditableSelects.init();
       
    30 
    29 	formObj.bgcolor.value = bgcolor;
    31 	formObj.bgcolor.value = bgcolor;
    30 	formObj.backgroundimage.value = backgroundimage;
    32 	formObj.backgroundimage.value = backgroundimage;
    31 	formObj.height.value = height;
    33 	formObj.height.value = height;
    32 	formObj.id.value = id;
    34 	formObj.id.value = id;
    33 	formObj.lang.value = lang;
    35 	formObj.lang.value = lang;
    34 	formObj.style.value = dom.serializeStyle(st);
    36 	formObj.style.value = dom.serializeStyle(st);
    35 	selectByValue(formObj, 'align', align);
    37 	selectByValue(formObj, 'align', align);
    36 	selectByValue(formObj, 'valign', valign);
    38 	selectByValue(formObj, 'valign', valign);
    37 	selectByValue(formObj, 'class', className);
    39 	selectByValue(formObj, 'class', className, true, true);
    38 	selectByValue(formObj, 'rowtype', rowtype);
    40 	selectByValue(formObj, 'rowtype', rowtype);
    39 	selectByValue(formObj, 'dir', dir);
    41 	selectByValue(formObj, 'dir', dir);
    40 
    42 
    41 	// Resize some elements
    43 	// Resize some elements
    42 	if (isVisible('backgroundimagebrowser'))
    44 	if (isVisible('backgroundimagebrowser'))
    44 
    46 
    45 	updateColor('bgcolor_pick', 'bgcolor');
    47 	updateColor('bgcolor_pick', 'bgcolor');
    46 }
    48 }
    47 
    49 
    48 function updateAction() {
    50 function updateAction() {
    49 	var inst = tinyMCEPopup.editor;
    51 	var inst = tinyMCEPopup.editor, dom = inst.dom, trElm, tableElm, formObj = document.forms[0];
    50 	var dom = inst.dom;
       
    51 	var trElm = dom.getParent(inst.selection.getNode(), "tr");
       
    52 	var tableElm = dom.getParent(inst.selection.getNode(), "table");
       
    53 	var formObj = document.forms[0];
       
    54 	var action = getSelectValue(formObj, 'action');
    52 	var action = getSelectValue(formObj, 'action');
       
    53 
       
    54 	tinyMCEPopup.restoreSelection();
       
    55 	trElm = dom.getParent(inst.selection.getNode(), "tr");
       
    56 	tableElm = dom.getParent(inst.selection.getNode(), "table");
    55 
    57 
    56 	inst.execCommand('mceBeginUndoLevel');
    58 	inst.execCommand('mceBeginUndoLevel');
    57 
    59 
    58 	switch (action) {
    60 	switch (action) {
    59 		case "row":
    61 		case "row":
   134 		}
   136 		}
   135 
   137 
   136 		if (newParent == null) {
   138 		if (newParent == null) {
   137 			newParent = doc.createElement(dest);
   139 			newParent = doc.createElement(dest);
   138 
   140 
   139 			if (dest == "thead")
   141 			if (dest == "thead") {
   140 				theTable.insertBefore(newParent, theTable.firstChild);
   142 				if (theTable.firstChild.nodeName == 'CAPTION')
   141 			else
   143 					inst.dom.insertAfter(newParent, theTable.firstChild);
       
   144 				else
       
   145 					theTable.insertBefore(newParent, theTable.firstChild);
       
   146 			} else
   142 				theTable.appendChild(newParent);
   147 				theTable.appendChild(newParent);
   143 		}
   148 		}
   144 
   149 
   145 		// append the row to the new parent
   150 		// append the row to the new parent
   146 		newParent.appendChild(newRow);
   151 		newParent.appendChild(newRow);