Ticket #6972: dd_dt_li.patch

File dd_dt_li.patch, 2.3 KB (added by yiminghe, 13 years ago)
  • fragment.js

     
    130130                                else
    131131                                        elementName =  element.name;
    132132
    133                                 if ( elementName && elementName in CKEDITOR.dtd.$inline )
     133                                //revert to original
     134                //better ? fix malform html
     135                if (elementName
     136                    && !( elementName in CKEDITOR.dtd.$body )
     137                    && !( elementName in CKEDITOR.dtd.$nonBodyContent ))
    134138                                {
    135139                                        var savedCurrent = currentNode;
    136140
    137                                         // Create a <p> in the fragment.
    138                                         currentNode = target;
    139                                         parser.onTagOpen( fixForBody, {} );
     141                                        // Create a <p/dl/ul> in the fragment.
     142                    currentNode = target;
     143                    var meta = {
     144                        li:"ul",
     145                        dt:"dl",
     146                        dd:"dl"
     147                    };
     148                    parser.onTagOpen(meta[elementName] || fixForBody, {});
    140149
    141                                         // The new target now is the <p>.
     150                                        // The new target now is the <p/dl/ul>.
    142151                                        target = currentNode;
    143152
    144153                                        if ( enforceCurrent )
     
    236245                                {
    237246                                        addElement( currentNode, currentNode.parent );
    238247                                }
    239                                 else if ( tagName in CKEDITOR.dtd.$listItem )
    240                                 {
    241                                         parser.onTagOpen( 'ul', {} );
    242                                         addPoint = currentNode;
    243                                         reApply = true;
    244                                 }
     248                //do not need this ??
     249//                              else if ( tagName in CKEDITOR.dtd.$listItem )
     250//                              {
     251//                                      parser.onTagOpen( 'ul', {} );
     252//                                      addPoint = currentNode;
     253//                                      reApply = true;
     254//                              }
    245255                                else
    246256                                {
    247                                         if ( nonBreakingBlocks[ currentName ] )
     257                    //sorry about this ugly exclusion,i am not actually sure
     258                                        if (!currentName in {li:1,dd:1,dt:1} && nonBreakingBlocks[ currentName ])
    248259                                        {
    249260                                                if ( !returnPoint )
    250261                                                        returnPoint = currentNode;
     
    253264                                        {
    254265                                                addElement( currentNode, currentNode.parent, true );
    255266
    256                                                 if ( !optionalClose[ currentName ] )
     267                                                //only care about inline
     268                        if (!optionalClose[ currentName ] && currentName in CKEDITOR.dtd.$inline)
    257269                                                {
    258270                                                        // The current element is an inline element, which
    259271                                                        // cannot hold the new one. Put it in the pending list,
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy