Changeset 2104 for FCKeditor/branches

Show
Ignore:
Timestamp:
2008-06-23 10:59:19 (5 months ago)
Author:
martinkou
Message:

Fixed the div container dialog's style menu to only display styles for DIV elements.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/branches/features/div_container/editor/dialog/fck_div.html

    r2103 r2104  
    7979        // Popuplate the style menu 
    8080        var styles = FCKStyles.GetStyles() ; 
     81        var match = null ; 
     82        var selectableStyles = {} ; 
    8183        for ( var i in styles ) 
    8284        { 
    83                 if ( ! /^_FCK_/.test( i ) ) 
     85                if ( ! /^_FCK_/.test( i ) && styles[i].Element == 'div' ) 
    8486                { 
    85                         AddStyleOption( i ) ; 
    8687                        if ( ActiveEl && styles[i].CheckElementRemovable( ActiveEl, true ) ) 
    87                                 GetE( 'selStyle' ).value = i ; 
     88                                match = i ; 
     89                        selectableStyles[i] = styles[i] ; 
    8890                } 
    8991        } 
     92        if ( !match ) 
     93                AddStyleOption( "" ) ; 
     94        for ( var i in selectableStyles ) 
     95                AddStyleOption( i ) ; 
     96        if ( match ) 
     97                GetE( 'selStyle' ).value = i ; 
    9098 
    9199        if ( ActiveEl ) 
     
    131139 
    132140        var styleName = GetE( 'selStyle' ).value ; 
    133         var range = new oEditor.FCKDomRange( oEditor.FCK.EditorWindow ) ; 
    134         range.SetStart( ActiveEl, 3 ) ; 
    135         range.SetEnd( ActiveEl, 4 ) ; 
    136141        if ( styleName ) 
    137                 FCKStyles.GetStyle( styleName ).ApplyToRange( range, false, true ) ; 
     142                FCKStyles.GetStyle( styleName ).ApplyToObject( ActiveEl ) ; 
    138143 
    139144        return true ; 
     
    154159                                        <span fcklang="DlgDivStyle">Style</span><br /> 
    155160                                        <select id="selStyle" style="width: 100%;"> 
    156                                                 <option value="">&nbsp; 
    157161                                        </select> 
    158162                                </td>