<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >\r
<!--\r
* FCKeditor - The text editor for Internet - http://www.fckeditor.net\r
- * Copyright (C) 2003-2007 Frederico Caldeira Knabben\r
+ * Copyright (C) 2003-2010 Frederico Caldeira Knabben\r
*\r
* == BEGIN LICENSE ==\r
*\r
<script src="common/fck_dialog_common.js" type="text/javascript"></script>\r
<script type="text/javascript">\r
\r
-var oEditor = window.parent.InnerDialogLoaded() ;\r
+var dialog = window.parent ;\r
+var oEditor = dialog.InnerDialogLoaded() ;\r
\r
-// Gets the document DOM\r
-var oDOM = oEditor.FCK.EditorDocument ;\r
+var FCKDomTools = oEditor.FCKDomTools ;\r
\r
// Array of selected Cells\r
var aCells = oEditor.FCKTableHandler.GetSelectedCells() ;\r
\r
SetStartupValue() ;\r
\r
- window.parent.SetOkButton( true ) ;\r
- window.parent.SetAutoSize( true ) ;\r
+ dialog.SetOkButton( true ) ;\r
+ dialog.SetAutoSize( true ) ;\r
+ SelectField( 'txtWidth' ) ;\r
}\r
\r
function SetStartupValue()\r
GetE('txtCollSpan').value = GetAttribute( oCell, 'colSpan' ) ;\r
GetE('txtBackColor').value = GetAttribute( oCell, 'bgColor' ) ;\r
GetE('txtBorderColor').value = GetAttribute( oCell, 'borderColor' ) ;\r
-// GetE('cmbFontStyle').value = oCell.className ;\r
+ GetE('selCellType').value = oCell.nodeName.toLowerCase() ;\r
}\r
}\r
\r
// Fired when the user press the OK button\r
function Ok()\r
{\r
+ oEditor.FCKUndo.SaveUndoStep() ;\r
+\r
for( i = 0 ; i < aCells.length ; i++ )\r
{\r
if ( GetE('txtWidth').value.length > 0 )\r
aCells[i].removeAttribute( 'width', 0 ) ;\r
\r
if ( GetE('selWordWrap').value == 'false' )\r
- aCells[i].noWrap = true ;\r
+ SetAttribute( aCells[i], 'noWrap', 'nowrap' ) ;\r
else\r
aCells[i].removeAttribute( 'noWrap' ) ;\r
\r
SetAttribute( aCells[i], 'colSpan' , GetE('txtCollSpan').value ) ;\r
SetAttribute( aCells[i], 'bgColor' , GetE('txtBackColor').value ) ;\r
SetAttribute( aCells[i], 'borderColor' , GetE('txtBorderColor').value ) ;\r
-// SetAttribute( aCells[i], 'className' , GetE('cmbFontStyle').value ) ;\r
+\r
+ var cellType = GetE('selCellType').value ;\r
+ if ( aCells[i].nodeName.toLowerCase() != cellType )\r
+ aCells[i] = RenameNode( aCells[i], cellType ) ;\r
+ }\r
+\r
+ // The cells need to be reselected, otherwise the caret will appear inside the table borders (Gecko)\r
+ // or sent back to the beginning of the document (Opera and Safari).\r
+ // Strangely, IE works ok so no change is needed for IE.\r
+ if ( !oEditor.FCKBrowserInfo.IsIE )\r
+ {\r
+ var selection = oEditor.FCK.EditorWindow.getSelection() ;\r
+ selection.removeAllRanges() ;\r
+ for ( var i = 0 ; i < aCells.length ; i++ )\r
+ {\r
+ var range = oEditor.FCK.EditorDocument.createRange() ;\r
+ range.selectNode( aCells[i] ) ;\r
+ selection.addRange( range ) ;\r
+ }\r
}\r
\r
return true ;\r
\r
function SelectColor( wich )\r
{\r
- oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', oEditor.FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 400, 330, wich == 'Back' ? SelectBackColor : SelectBorderColor, window ) ;\r
+ oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', oEditor.FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 410, 320, wich == 'Back' ? SelectBackColor : SelectBorderColor ) ;\r
}\r
\r
</script>\r
<span fcklang="DlgCellWidth">Width</span>:</td>\r
<td>\r
<input onkeypress="return IsDigit(event);" id="txtWidth" type="text" maxlength="4"\r
- size="3" name="txtWidth" /> <select id="selWidthType" name="selWidthType">\r
+ size="3" /> <select id="selWidthType">\r
<option fcklang="DlgCellWidthPx" value="pixels" selected="selected">pixels</option>\r
<option fcklang="DlgCellWidthPc" value="percent">percent</option>\r
</select></td>\r
<td nowrap="nowrap">\r
<span fcklang="DlgCellHeight">Height</span>:</td>\r
<td>\r
- <input id="txtHeight" type="text" maxlength="4" size="3" name="txtHeight" onkeypress="return IsDigit(event);" /> <span\r
+ <input id="txtHeight" type="text" maxlength="4" size="3" onkeypress="return IsDigit(event);" /> <span\r
fcklang="DlgCellWidthPx">pixels</span></td>\r
</tr>\r
<tr>\r
<td nowrap="nowrap">\r
<span fcklang="DlgCellWordWrap">Word Wrap</span>:</td>\r
<td>\r
- <select id="selWordWrap" name="selAlignment">\r
+ <select id="selWordWrap">\r
<option fcklang="DlgCellWordWrapYes" value="true" selected="selected">Yes</option>\r
<option fcklang="DlgCellWordWrapNo" value="false">No</option>\r
</select></td>\r
<td nowrap="nowrap">\r
<span fcklang="DlgCellHorAlign">Horizontal Alignment</span>:</td>\r
<td>\r
- <select id="selHAlign" name="selAlignment">\r
+ <select id="selHAlign">\r
<option fcklang="DlgCellHorAlignNotSet" value="" selected><Not set></option>\r
<option fcklang="DlgCellHorAlignLeft" value="left">Left</option>\r
<option fcklang="DlgCellHorAlignCenter" value="center">Center</option>\r
<td nowrap="nowrap">\r
<span fcklang="DlgCellVerAlign">Vertical Alignment</span>:</td>\r
<td>\r
- <select id="selVAlign" name="selAlignment">\r
+ <select id="selVAlign">\r
<option fcklang="DlgCellVerAlignNotSet" value="" selected><Not set></option>\r
<option fcklang="DlgCellVerAlignTop" value="top">Top</option>\r
<option fcklang="DlgCellVerAlignMiddle" value="middle">Middle</option>\r
<table cellspacing="0" cellpadding="0" border="0">\r
<tr>\r
<td nowrap="nowrap">\r
+ <span fcklang="DlgCellType">Cell Type</span>:</td>\r
+ <td colspan="2">\r
+ <select id="selCellType">\r
+ <option fcklang="DlgCellTypeData" value="td">Data</option>\r
+ <option fcklang="DlgCellTypeHeader" value="th">Header</option>\r
+ </select>\r
+ </tr>\r
+ <tr>\r
+ <td>\r
+ </td>\r
+ <td>\r
+ </td>\r
+ <td>\r
+ </td>\r
+ </tr>\r
+ <tr>\r
+ <td nowrap="nowrap">\r
<span fcklang="DlgCellRowSpan">Rows Span</span>:</td>\r
<td>\r
\r
<input onkeypress="return IsDigit(event);" id="txtRowSpan" type="text" maxlength="3" size="2"\r
- name="txtRows"></td>\r
+ ></td>\r
<td>\r
</td>\r
</tr>\r
<td>\r
\r
<input onkeypress="return IsDigit(event);" id="txtCollSpan" type="text" maxlength="2"\r
- size="2" name="txtColumns"></td>\r
+ size="2"></td>\r
<td>\r
</td>\r
</tr>\r
<td nowrap="nowrap">\r
<span fcklang="DlgCellBackColor">Background Color</span>:</td>\r
<td>\r
- <input id="txtBackColor" type="text" size="8" name="txtCellSpacing"></td>\r
+ <input id="txtBackColor" type="text" size="8" /></td>\r
<td>\r
\r
<input type="button" fcklang="DlgCellBtnSelect" value="Select..." onclick="SelectColor( 'Back' )"></td>\r
<td nowrap="nowrap">\r
<span fcklang="DlgCellBorderColor">Border Color</span>:</td>\r
<td>\r
- <input id="txtBorderColor" type="text" size="8" name="txtCellPadding" /></td>\r
+ <input id="txtBorderColor" type="text" size="8" /></td>\r
<td>\r
\r
<input type="button" fcklang="DlgCellBtnSelect" value="Select..." onclick="SelectColor( 'Border' )" /></td>\r