Show
Ignore:
Timestamp:
2008-08-19 11:28:15 (5 months ago)
Author:
alfonsoml
Message:

Fix for #822. Add the ability to switch between TD and TH

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/trunk/editor/dialog/fck_tablecell.html

    r1795 r2363  
    3333var oEditor = dialog.InnerDialogLoaded() ; 
    3434 
    35 // Gets the document DOM 
    36 var oDOM = oEditor.FCK.EditorDocument ; 
     35var FCKDomTools = oEditor.FCKDomTools ; 
    3736 
    3837// Array of selected Cells 
     
    7574                GetE('txtBackColor').value              = GetAttribute( oCell, 'bgColor' ) ; 
    7675                GetE('txtBorderColor').value    = GetAttribute( oCell, 'borderColor' ) ; 
    77 //              GetE('cmbFontStyle').value              = oCell.className ; 
     76                GetE('selCellType').value     = oCell.nodeName.toLowerCase() ;  
    7877        } 
    7978} 
     
    101100                SetAttribute( aCells[i], 'bgColor'              , GetE('txtBackColor').value ) ; 
    102101                SetAttribute( aCells[i], 'borderColor'  , GetE('txtBorderColor').value ) ; 
    103 //              SetAttribute( aCells[i], 'className'    , GetE('cmbFontStyle').value ) ; 
     102 
     103                var cellType = GetE('selCellType').value ;  
     104                if ( aCells[i].nodeName.toLowerCase() != cellType )  
     105                        aCells[i] = RenameNode( aCells[i], cellType ) ; 
    104106        } 
     107 
     108        // The cells need to be reselected, otherwise the caret will appear inside the table borders (Gecko)  
     109        // or sent back to the beginning of the document (Opera and Safari).  
     110        // Strangely, IE works ok so no change is needed for IE.  
     111        if ( !oEditor.FCKBrowserInfo.IsIE )  
     112        {  
     113                var selection = oEditor.FCK.EditorWindow.getSelection() ;  
     114                selection.removeAllRanges() ;  
     115                for ( var i = 0 ; i < aCells.length ; i++ )  
     116                {  
     117                        var range = oEditor.FCK.EditorDocument.createRange() ;  
     118                        range.selectNode( aCells[i] ) ;  
     119                        selection.addRange( range ) ;  
     120                }  
     121        }  
    105122 
    106123        return true ; 
     
    203220                                                                <tr> 
    204221                                                                        <td nowrap="nowrap"> 
     222                                                                         <span fcklang="DlgCellType">Cell Type</span>:</td>  
     223                                                                        <td colspan="2">  
     224                                                                                &nbsp; <select id="selCellType">  
     225                                                                                        <option fcklang="DlgCellTypeData" value="td" />Data  
     226                                                                                        <option fcklang="DlgCellTypeHeader" value="th" />Header  
     227                                                                                </select>  
     228                                                                </tr>  
     229                                                                <tr>  
     230                                                                        <td>  
     231                                                                                &nbsp;</td>  
     232                                                                        <td>  
     233                                                                                &nbsp;</td>  
     234                                                                        <td>  
     235                                                                                &nbsp;</td>  
     236                                                                </tr>  
     237                                                                <tr>  
     238                                                                        <td nowrap="nowrap">  
    205239                                                                                <span fcklang="DlgCellRowSpan">Rows Span</span>:</td> 
    206240                                                                        <td>