Ticket #5568: 5568.patch

File 5568.patch, 3.2 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/selection/plugin.js

     
    10091009{
    10101010var notWhitespaces = CKEDITOR.dom.walker.whitespaces( true );
    10111011var fillerTextRegex = /\ufeff|\u00a0/;
     1012var nonCells = { table:1,tbody:1,tr:1 };
    10121013
    10131014CKEDITOR.dom.range.prototype.select =
    10141015        CKEDITOR.env.ie ?
     
    10191020                        var isStartMarkerAlone;
    10201021                        var dummySpan;
    10211022
     1023                        // IE doesn't support selecting the entire table row/cell, move the selection into cells, e.g.
     1024                        // <table><tbody><tr>[<td>cell</b></td>... => <table><tbody><tr><td>[cell</td>...
     1025                        if ( this.startContainer.type == CKEDITOR.NODE_ELEMENT && this.startContainer.getName() in nonCells
     1026                                || this.endContainer.type == CKEDITOR.NODE_ELEMENT && this.endContainer.getName() in nonCells )
     1027                        {
     1028                                this.shrink( CKEDITOR.NODE_ELEMENT, true );
     1029                        }
     1030
    10221031                        var bookmark = this.createBookmark();
    10231032
    10241033                        // Create marker tags for the start and end boundaries.
  • _source/core/dom/range.js

     
    12401240                 *  always anchor beside text nodes or innermost element.
    12411241                 * @param {Number} mode  ( CKEDITOR.SHRINK_ELEMENT | CKEDITOR.SHRINK_TEXT ) The shrinking mode.
    12421242                 */
    1243                 shrink : function( mode )
     1243                shrink : function( mode, selectContents )
    12441244                {
    12451245                        // Unable to shrink a collapsed range.
    12461246                        if ( !this.collapsed )
     
    13151315                                if ( moveStart )
    13161316                                {
    13171317                                        var textStart = walker[ mode == CKEDITOR.SHRINK_ELEMENT ? 'lastForward' : 'next']();
    1318                                         textStart && this.setStartBefore( textStart );
     1318                                        textStart && this.setStartAt( textStart, selectContents ? CKEDITOR.POSITION_AFTER_START : CKEDITOR.POSITION_BEFORE_START );
    13191319                                }
    13201320
    13211321                                if ( moveEnd )
    13221322                                {
    13231323                                        walker.reset();
    13241324                                        var textEnd = walker[ mode == CKEDITOR.SHRINK_ELEMENT ? 'lastBackward' : 'previous']();
    1325                                         textEnd && this.setEndAfter( textEnd );
     1325                                        textEnd && this.setEndAt( textEnd, selectContents ? CKEDITOR.POSITION_BEFORE_END : CKEDITOR.POSITION_AFTER_END );
    13261326                                }
    13271327
    13281328                                return !!( moveStart || moveEnd );
     
    13821382                        // we will not need this check for our use of this class so we can
    13831383                        // ignore it for now.
    13841384
     1385                        // Fixing invalid range start inside dtd empty elements.
     1386                        if( startNode.type == CKEDITOR.NODE_ELEMENT
     1387                                && CKEDITOR.dtd.$empty[ startNode.getName() ] )
     1388                                startNode = startNode.getParent(), startOffset = startNode.getIndex();
     1389                       
    13851390                        this.startContainer     = startNode;
    13861391                        this.startOffset        = startOffset;
    13871392
     
    14081413                        // will not need this check for our use of this class so we can ignore
    14091414                        // it for now.
    14101415
     1416                        // Fixing invalid range end inside dtd empty elements.
     1417                        if( endNode.type == CKEDITOR.NODE_ELEMENT
     1418                                && CKEDITOR.dtd.$empty[ endNode.getName() ] )
     1419                                endNode = endNode.getParent(), endOffset = endNode.getIndex() + 1;
     1420
    14111421                        this.endContainer       = endNode;
    14121422                        this.endOffset          = endOffset;
    14131423
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy