Ticket #6649: 6649_2.patch
File 6649_2.patch, 3.6 KB (added by , 13 years ago) |
---|
-
_source/plugins/selection/plugin.js
1061 1061 return; 1062 1062 } 1063 1063 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(); 1086 1068 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(); 1094 1071 1095 // Select the range.1096 var sel = this.getNative();1097 sel.removeAllRanges();1098 sel.addRange( range );1099 1100 this.reset();1101 }1102 1072 }, 1103 1073 1104 1074 /** … … 1273 1243 // V2 1274 1244 function( forceExpand ) 1275 1245 { 1276 var collapsed = this.collapsed; 1277 var isStartMarkerAlone; 1278 var dummySpan; 1246 var collapsed = this.collapsed, 1247 isStartMarkerAlone, dummySpan, ieRange; 1279 1248 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 1280 1263 // IE doesn't support selecting the entire table row/cell, move the selection into cells, e.g. 1281 1264 // <table><tbody><tr>[<td>cell</b></td>... => <table><tbody><tr><td>[cell</td>... 1282 1265 if ( this.startContainer.type == CKEDITOR.NODE_ELEMENT && this.startContainer.getName() in nonCells … … 1295 1278 endNode = bookmark.endNode; 1296 1279 1297 1280 // Create the main range which will be used for the selection. 1298 varieRange = this.document.$.body.createTextRange();1281 ieRange = this.document.$.body.createTextRange(); 1299 1282 1300 1283 // Position the range at the start boundary. 1301 1284 ieRange.moveToElementText( startNode.$ ); -
_source/plugins/tabletools/plugin.js
721 721 if ( !table ) 722 722 return; 723 723 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 730 724 // If the table's parent has only one child remove it as well (unless it's the body or a table cell) (#5416, #6289) 731 725 var parent = table.getParent(); 732 726 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(); 736 733 } 737 734 } ); 738 735