Ticket #7645: 7645_2.patch
File 7645_2.patch, 4.7 KB (added by , 14 years ago) |
---|
-
_source/plugins/wysiwygarea/plugin.js
758 758 759 759 // Delete any element that 'hasLayout' (e.g. hr,table) in IE8 will 760 760 // break up the selection, safely manage it here. (#4795) 761 var bookmark = sel.getRanges()[ 0 ].createBookmark();761 var bookmark = range.createBookmark(); 762 762 // Remove the control manually. 763 763 control.remove(); 764 764 sel.selectBookmarks( [ bookmark ] ); … … 767 767 768 768 evt.data.preventDefault(); 769 769 } 770 771 // A fully selected table/list produces a range anchors only at inner boundaries, enlarge it here. (#7645) 772 var range = sel.getRanges()[ 0 ]; 773 if ( range.enlarge( CKEDITOR.ENLARGE_LIST_TABLE ) ) 774 range.select(); 770 775 } 771 776 } ); 772 777 -
_source/core/dom/walker.js
446 446 // Check if there's a filler node at the end of an element, and return it. 447 447 CKEDITOR.dom.element.prototype.getBogus = function() 448 448 { 449 if ( !this.isBlockBoundary() ) 450 return null; 451 449 452 // Bogus are not always at the end, e.g. <p><a>text<br /></a></p> (#7070). 450 453 var tail = this; 451 454 do { tail = tail.getPreviousSourceNode(); } -
_source/core/dom/range.js
386 386 { 387 387 // Reject any text node unless it's being bookmark 388 388 // OR it's spaces. (#3883) 389 return node.type != CKEDITOR.NODE_TEXT 390 && node.getName() in CKEDITOR.dtd.$removeEmpty 391 || !CKEDITOR.tools.trim( node.getText() ) 392 || !!node.getParent().data( 'cke-bookmark' ); 389 return node.type == CKEDITOR.NODE_TEXT ? 390 !CKEDITOR.tools.trim( node.getText() ) || node.getParent().data( 'cke-bookmark' ) 391 : node.getName() in CKEDITOR.dtd.$removeEmpty; 393 392 } 394 393 395 394 var whitespaceEval = new CKEDITOR.dom.walker.whitespaces(), … … 1349 1348 // one and we're expanding list item contents 1350 1349 if ( tailBr ) 1351 1350 this.setEndAfter( tailBr ); 1352 } 1351 break; 1352 1353 case CKEDITOR.ENLARGE_LIST_TABLE: 1354 1355 var ancestor = this.getCommonAncestor( 1, 1 ), 1356 root; 1357 1358 var tags = { table:1,ul:1,ol:1,dl:1}; 1359 for ( var t in tags ) 1360 { 1361 root = ancestor.getAscendant( t, 1 ); 1362 if ( root ) break; 1363 } 1364 1365 if ( !root ) 1366 return false; 1367 1368 // Enlarging the start boundary. 1369 walkerRange = new CKEDITOR.dom.range( this.document ); 1370 walkerRange.setStartAt( root, CKEDITOR.POSITION_AFTER_START ); 1371 walkerRange.setEnd( this.startContainer, this.startOffset ); 1372 1373 var enlargeables = CKEDITOR.tools.extend( tags, CKEDITOR.dtd.$listItem, CKEDITOR.dtd.$tableContent ); 1374 walker = new CKEDITOR.dom.walker( walkerRange ), 1375 1376 // Check the range is at the inner boundary of the structural element. 1377 guard = function( walker, isEnd ) 1378 { 1379 return function( node, isWalkOut ) 1380 { 1381 if ( node.type == CKEDITOR.NODE_TEXT && ( !CKEDITOR.tools.trim( node.getText() ) || node.getParent().data( 'cke-bookmark' ) ) ) 1382 return true; 1383 1384 var tag; 1385 if ( node.type == CKEDITOR.NODE_ELEMENT ) 1386 { 1387 tag = node.getName(); 1388 1389 // Bypass bogus br at the end of block. 1390 if ( tag == 'br' && isEnd && node.equals( node.getParent().getBogus() ) ) 1391 return true; 1392 1393 if ( isWalkOut && tag in enlargeables || tag in CKEDITOR.dtd.$removeEmpty ) 1394 return true; 1395 } 1396 1397 walker.halted = 1; 1398 return false; 1399 }; 1400 }; 1401 1402 walker.guard = guard( walker ); 1403 1404 if ( walker.checkBackward() && !walker.halted ) 1405 { 1406 walker = new CKEDITOR.dom.walker( walkerRange ); 1407 walkerRange.setStart( this.endContainer, this.endOffset ); 1408 walkerRange.setEndAt( root, CKEDITOR.POSITION_BEFORE_END ); 1409 walker.guard = guard( walker, 1 ); 1410 if ( walker.checkForward() && !walker.halted ) 1411 { 1412 this.setStartBefore( root ); 1413 this.setEndAfter( root ); 1414 return true; 1415 } 1416 } 1417 } 1353 1418 }, 1354 1419 1355 1420 /** … … 2019 2084 CKEDITOR.ENLARGE_ELEMENT = 1; 2020 2085 CKEDITOR.ENLARGE_BLOCK_CONTENTS = 2; 2021 2086 CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS = 3; 2087 CKEDITOR.ENLARGE_LIST_TABLE = 4; 2022 2088 2023 2089 // Check boundary types. 2024 2090 // @see CKEDITOR.dom.range.prototype.checkBoundaryOfElement