Ticket #6649: 6649_2.patch

File 6649_2.patch, 3.6 KB (added by Garry Yao, 13 years ago)
  • _source/plugins/selection/plugin.js

     
    10611061                                return;
    10621062                        }
    10631063
    1064                         if ( CKEDITOR.env.ie )
    1065                         {
    1066                                 this.getNative().empty();
    1067 
    1068                                 try
    1069                                 {
    1070                                         // Try to select the node as a control.
    1071                                         range = this.document.$.body.createControlRange();
    1072                                         range.addElement( element.$ );
    1073                                         range.select();
    1074                                 }
    1075                                 catch( e )
    1076                                 {
    1077                                         // If failed, select it as a text range.
    1078                                         range = this.document.$.body.createTextRange();
    1079                                         range.moveToElementText( element.$ );
    1080                                         range.select();
    1081                                 }
    1082                                 finally
    1083                                 {
    1084                                         this.document.fire( 'selectionchange' );
    1085                                 }
     1064                        var range = new CKEDITOR.dom.range( element.getDocument() );
     1065                        range.setStartBefore( element );
     1066                        range.setEndAfter( element );
     1067                        range.select();
    10861068
    1087                                 this.reset();
    1088                         }
    1089                         else
    1090                         {
    1091                                 // Create the range for the element.
    1092                                 range = this.document.$.createRange();
    1093                                 range.selectNode( element.$ );
     1069                        this.document.fire( 'selectionchange' );
     1070                        this.reset();
    10941071
    1095                                 // Select the range.
    1096                                 var sel = this.getNative();
    1097                                 sel.removeAllRanges();
    1098                                 sel.addRange( range );
    1099 
    1100                                 this.reset();
    1101                         }
    11021072                },
    11031073
    11041074                /**
     
    12731243                        // V2
    12741244                        function( forceExpand )
    12751245                        {
    1276                                 var collapsed = this.collapsed;
    1277                                 var isStartMarkerAlone;
    1278                                 var dummySpan;
     1246                                var collapsed = this.collapsed,
     1247                                        isStartMarkerAlone, dummySpan, ieRange;
    12791248
     1249                                // Try to make a object selection.
     1250                                var selected = this.getEnclosedNode();
     1251                                if ( selected )
     1252                                {
     1253                                        try
     1254                                        {
     1255                                                ieRange = this.document.$.body.createControlRange();
     1256                                                ieRange.addElement( selected.$ );
     1257                                                ieRange.select();
     1258                                                return;
     1259                                        }
     1260                                        catch( er ) {}
     1261                                }
     1262
    12801263                                // IE doesn't support selecting the entire table row/cell, move the selection into cells, e.g.
    12811264                                // <table><tbody><tr>[<td>cell</b></td>... => <table><tbody><tr><td>[cell</td>...
    12821265                                if ( this.startContainer.type == CKEDITOR.NODE_ELEMENT && this.startContainer.getName() in nonCells
     
    12951278                                        endNode = bookmark.endNode;
    12961279
    12971280                                // Create the main range which will be used for the selection.
    1298                                 var ieRange = this.document.$.body.createTextRange();
     1281                                ieRange = this.document.$.body.createTextRange();
    12991282
    13001283                                // Position the range at the start boundary.
    13011284                                ieRange.moveToElementText( startNode.$ );
  • _source/plugins/tabletools/plugin.js

     
    721721                                                if ( !table )
    722722                                                        return;
    723723
    724                                                 // Maintain the selection point at where the table was deleted.
    725                                                 selection.selectElement( table );
    726                                                 var range = selection.getRanges()[0];
    727                                                 range.collapse();
    728                                                 selection.selectRanges( [ range ] );
    729 
    730724                                                // If the table's parent has only one child remove it as well (unless it's the body or a table cell) (#5416, #6289)
    731725                                                var parent = table.getParent();
    732726                                                if ( parent.getChildCount() == 1 && !parent.is( 'body', 'td', 'th' ) )
    733                                                         parent.remove();
    734                                                 else
    735                                                         table.remove();
     727                                                        table = parent;
     728
     729                                                var range = new CKEDITOR.dom.range( editor.document );
     730                                                range.moveToPosition( table, CKEDITOR.POSITION_BEFORE_START );
     731                                                table.remove();
     732                                                range.select();
    736733                                        }
    737734                                } );
    738735
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy