Ticket #503: 503.patch

File 503.patch, 1.1 KB (added by Martin Kou, 16 years ago)

Proposed patch for fixing #503.

  • editor/_source/internals/fckxhtml.js

     
    403403                return node ;
    404404        },
    405405
     406        // Fix orphaned <li> nodes (Bug #503).
     407        li : function( node, htmlNode, targetNode )
     408        {
     409                // If the XML parent node is already a <ul> or <ol>, then add the <li> as usual.
     410                if ( targetNode.nodeName.IEquals( ['ul', 'ol'] ) )
     411                        return FCKXHtml._AppendChildNodes( node, htmlNode, true ) ;
     412
     413                var newTarget ;
     414
     415                // Try to group orphaned <li> nodes into the last <ul>.
     416                // Create one if the previous added node wasn't an <ul>.
     417                if ( targetNode.lastChild && targetNode.lastChild.nodeName.IEquals( 'ul' ) )
     418                        newTarget = targetNode.lastChild ;
     419                else
     420                        newTarget = FCKXHtml.XML.createElement( 'ul' ) ;
     421                htmlNode._fckxhtmljob = null ;
     422                FCKXHtml._AppendNode( newTarget, htmlNode ) ;
     423                return newTarget ;
     424        },
     425
    406426        // Fix nested <ul> and <ol>.
    407427        ol : function( node, htmlNode, targetNode )
    408428        {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy