Ticket #5455: 5455_5.patch

File 5455_5.patch, 2.2 KB (added by Sa'ar Zac Elias, 14 years ago)
  • _source/core/dom/element.js

     
    850850                        :
    851851                                function()
    852852                                {
    853                                         var attributes = this.$.attributes;
    854                                         return ( attributes.length > 1 || ( attributes.length == 1 && attributes[0].nodeName != '_cke_expando' ) );
     853                                        var attrs = this.$.attributes,
     854                                                attrsNum = attrs.length,
     855                                                // The _moz_dirty attribute might get into the element after pasting (#5455)
     856                                                execludeAttrs = { _cke_expando : 1, _moz_dirty : 1 };
     857                                        if ( attrsNum == 1 && execludeAttrs[ attrs[0].nodeName ] )
     858                                                return false;
     859                                        else if ( attrsNum == 2 && execludeAttrs[ attrs[0].nodeName ] && execludeAttrs[ attrs[1].nodeName ] )
     860                                                return false;
     861                                        return attrsNum > 0;
    855862                                },
    856863
    857864                /**
  • _source/plugins/styles/plugin.js

     
    10301030                {
    10311031                        // Removing elements may open points where merging is possible,
    10321032                        // so let's cache the first and last nodes for later checking.
    1033                         var firstChild  = element.getFirst();
    1034                         var lastChild   = element.getLast();
     1033                        var firstChild = element.getFirst(),
     1034                                lastChild = element.getLast();
    10351035
    10361036                        element.remove( true );
    10371037
     
    10411041                                firstChild.type == CKEDITOR.NODE_ELEMENT && firstChild.mergeSiblings();
    10421042
    10431043                                if ( lastChild && !firstChild.equals( lastChild )
    1044                                         && lastChild.type == CKEDITOR.NODE_ELEMENT  )
     1044                                        && lastChild.type == CKEDITOR.NODE_ELEMENT )
    10451045                                        lastChild.mergeSiblings();
    10461046                        }
    10471047                }
     1048                // We intend to remove the element while still have attributes left on it,
     1049                // migrate them it into a span (without additional semantics) element instead.
     1050                else
     1051                {
     1052                        var replacement = new CKEDITOR.dom.element( 'span' );
     1053                        element.copyAttributes( replacement, { _cke_expando : 1, _moz_dirty : 1 } );
     1054                        element.moveChildren( replacement );
     1055                        replacement.replace( element );
     1056                        replacement.mergeSiblings();
     1057                }
    10481058        }
    10491059
    10501060        function getElement( style, targetDocument )
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy