Ticket #156: fck.style.combobox.patch

File fck.style.combobox.patch, 2.4 KB (added by joelwreed@…, 17 years ago)
  • editor/_source/classes/fckstyledef_ie.js

    diff -up -urwbB /home/jreed/tmp/fck/2.4/fckeditor/editor/_source/classes/fckstyledef_ie.js editor/_source/classes/fckstyledef_ie.js
    old new FCKStyleDef.prototype.ApplyToSelection = 
    3131       
    3232        if ( oSelection.type == 'Text' )
    3333        {
    34                 var oRange = oSelection.createRange() ;
    35                
    36                 // Create the main element.
    37                 var e = document.createElement( this.Element ) ;
    38                 e.innerHTML = oRange.htmlText ;
    39                
    40                 // Set the attributes.
    41                 this._AddAttributes( e ) ;
    42                
    43                 // Remove the duplicated elements.
    44                 this._RemoveDuplicates( e ) ;
    45                
    46                 // Replace the selection with the resulting HTML.
    47                 oRange.pasteHTML( e.outerHTML ) ;
     34                var oControl = FCK.ToolbarSet.CurrentInstance.Selection.GetParentElement() ;
     35                if ( oControl.tagName == this.Element )
     36                        this._AddAttributes( oControl ) ;
    4837        }
    4938        else if ( oSelection.type == 'Control' )
    5039        {
    FCKStyleDef.prototype.IsEqual = function 
    10190                                if ( e.style.cssText.toLowerCase() != this.Attributes[a].toLowerCase() )
    10291                                        return false ;
    10392                                break ;
     93                        case 'src' :
     94                                var src = e.getAttribute( '_fcksavedurl' ) ;
     95                                if (src == null) src = e.getAttribute( a, 0 );
     96                                if (src != this.Attributes[a])
     97                                        return false;
     98                                break;
    10499                        case 'class' :
    105100                                if ( e.getAttribute( 'className', 0 ) != this.Attributes[a] )
    106101                                        return false ;
  • editor/_source/classes/fcktoolbarstylecombo.js

    diff -up -urwbB /home/jreed/tmp/fck/2.4/fckeditor/editor/_source/classes/fcktoolbarstylecombo.js editor/_source/classes/fcktoolbarstylecombo.js
    old new FCKToolbarStyleCombo.prototype.RefreshAc 
    101101
    102102FCKToolbarStyleCombo.prototype.RefreshVisibleItems = function( targetSpecialCombo )
    103103{
     104        var sTagName;
     105
    104106        if ( FCKSelection.GetType() == 'Control' )
    105                 var sTagName = FCKSelection.GetSelectedElement().tagName ;
     107                sTagName = FCKSelection.GetSelectedElement().tagName ;
     108        else
     109                {
     110                        if (FCKBrowserInfo.IsIE)
     111                                {
     112                                        var e = FCKSelection.GetParentElement();
     113                                        if (!e) return;
     114                                        sTagName = e.tagName ;
     115                                }
     116                }
    106117
    107118        for ( var i in targetSpecialCombo.Items )
    108119        {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy