Ticket #6461: 6461_2.patch

File 6461_2.patch, 1.4 KB (added by Sa'ar Zac Elias, 14 years ago)
  • _source/plugins/list/plugin.js

     
    108108                                                currentListItem = item.element.clone( false, true );
    109109                                        else
    110110                                        {
    111                                                 // Create completely new blocks here, attributes are dropped.
    112                                                 if ( dir || ( paragraphMode != CKEDITOR.ENTER_BR && item.grandparent.getName() != 'td' ) )
     111                                                // Create completely new blocks here.
     112                                                if ( dir || item.element.hasAttributes() ||
     113                                                        ( paragraphMode != CKEDITOR.ENTER_BR && item.grandparent.getName() != 'td' ) )
    113114                                                {
    114115                                                        currentListItem = doc.createElement( paragraphName );
    115                                                         if ( dir )
    116                                                                 currentListItem.setAttribute( 'dir', dir );
     116                                                        item.element.copyAttributes( currentListItem, { type:1, value:1 } );
     117                                                        dir && currentListItem.setAttribute( 'dir', dir );
     118
     119                                                        // There might be a case where there are no attributes in the element after all
     120                                                        // (i.e. when "type" or "value" are the only attributes set). In this case, if enterMode = BR,
     121                                                        // the current item should be a fragment.
     122                                                        if ( !dir && paragraphMode == CKEDITOR.ENTER_BR && !currentListItem.hasAttributes() )
     123                                                                currentListItem = new CKEDITOR.dom.documentFragment( doc );
    117124                                                }
    118125                                                else
    119126                                                        currentListItem = new CKEDITOR.dom.documentFragment( doc );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy