Ticket #1537: 1537_2.patch

File 1537_2.patch, 1.6 KB (added by Martin Kou, 11 years ago)
  • editor/_source/internals/fck_ie.js

     
    172172        oSel.createRange().pasteHTML( html ) ;
    173173
    174174        // Remove the fake node
    175         FCK.EditorDocument.getElementById('__fakeFCKRemove__').removeNode( true ) ;
     175        var fake = FCK.EditorDocument.getElementById('__fakeFCKRemove__') ;
     176        // If the span is the only child of a node (so the inserted HTML is beyond that),
     177        // remove also that parent that isn't needed. #1537
     178        if (fake.parentNode.childNodes.length == 1)
     179                fake = fake.parentNode ;
     180        fake.removeNode( true ) ;
    176181
    177182        FCKDocumentProcessor.Process( FCK.EditorDocument ) ;
    178183
  • editor/_source/internals/fck_gecko.js

     
    375375
    376376                range = new FCKDomRange( this.EditorWindow ) ;
    377377                range.MoveToSelection() ;
     378
     379                // If the first element (if exists) of the document fragment is a block
     380                // element, then split the current block. (#1537)
     381                var currentNode = docFrag.RootNode.firstChild ;
     382                while ( currentNode && currentNode.nodeType != 1 )
     383                        currentNode = currentNode.nextSibling ;
     384               
     385                if ( currentNode && FCKListsLib.BlockElements[ currentNode.nodeName.toLowerCase() ] )
     386                        range.SplitBlock() ;
     387
    378388                range.DeleteContents() ;
    379389                range.InsertNode( docFrag.RootNode ) ;
    380390
© 2003 – 2020 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy