Ticket #3146: 3146.patch

File 3146.patch, 1.2 KB (added by Martin Kou, 15 years ago)
  • _source/plugins/styles/plugin.js

     
    277277
    278278                // Get the first node to be processed and the last, which concludes the
    279279                // processing.
    280                 var firstNode = range.startContainer.getChild( range.startOffset ) || range.startContainer.getNextSourceNode();
    281                 var lastNode = range.endContainer.getChild( range.endOffset ) || ( range.endOffset ? range.endContainer.getNextSourceNode() : range.endContainer );
     280                var boundaryNodes = range.getBoundaryNodes();
     281                var firstNode = boundaryNodes.startNode;
     282                var lastNode = boundaryNodes.endNode;
    282283
     284                // The detection algorithm below skips the contents inside bookmark nodes, so
     285                // we'll need to make sure lastNode isn't the   inside a bookmark node.
     286                var lastParent = lastNode.getParent();
     287                if ( lastParent && lastParent.type == CKEDITOR.NODE_ELEMENT && lastParent.getAttribute( '_fck_bookmark' ) )
     288                        lastNode = lastParent;
     289
    283290                if ( lastNode.equals( firstNode ) )
    284291                {
    285292                        // If the last node is the same as the the first one, we must move
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy