Ticket #4696: 4696.patch
File 4696.patch, 4.9 KB (added by , 14 years ago) |
---|
-
_source/plugins/pagebreak/plugin.js
80 80 // Creates the fake image used for this element. 81 81 breakObject = editor.createFakeElement( breakObject, 'cke_pagebreak', 'div' ); 82 82 83 var ranges = editor.getSelection().getRanges(); 83 var ranges = editor.getSelection().getRanges(), 84 lastRangeIndex = ranges.length - 1, 85 range; 84 86 85 for ( var range, i = 0 ; i < ranges.length ; i++)87 for ( var i = lastRangeIndex ; i >= 0 ; i-- ) 86 88 { 87 89 range = ranges[ i ]; 88 90 89 if ( i > 0)91 if ( i < lastRangeIndex ) 90 92 breakObject = breakObject.clone( true ); 91 93 92 range.splitBlock( 'p' ); 94 // Make sure it's inserted under body, split elements 95 // when necessary. (#4696) 96 var current; 97 while ( ( current = range.getCommonAncestor( false, true ) ) && !current.is( 'body' ) ) 98 range.splitBlock(); 93 99 range.insertNode( breakObject ); 94 } 95 } 100 101 // Place cursor at the next editable position. 102 if( i == lastRangeIndex ) 103 { 104 var next = breakObject.getNextSourceNode( true ); 105 if ( next && next.type == CKEDITOR.NODE_ELEMENT ) 106 range.moveToElementEditStart( next ); 107 else 108 range.collapse(); 109 110 range.select( true ); 111 } 112 } 113 } 96 114 }; -
_source/core/dom/elementpath.js
9 9 var pathBlockElements = { address:1,blockquote:1,dl:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1,li:1,dt:1,de:1 }; 10 10 11 11 // Elements that may be considered the "Block limit" in an element path. 12 var pathBlockLimitElements = { body:1,div:1,table:1,tbody:1,tr:1,td:1,th:1,caption:1,form:1 };12 var pathBlockLimitElements = { body:1,div:1,table:1,tbody:1,tr:1,td:1,th:1,caption:1,form:1,ul:1,ol:1,dl:1 }; 13 13 14 14 // Check if an element contains any block element. 15 15 var checkHasBlock = function( element ) -
_source/core/dom/range.js
1405 1405 return fixedBlock; 1406 1406 }, 1407 1407 1408 /** 1409 * Remove the contents of the range, and split the then occupied 1410 * block into two, while setup the new position between them. 1411 * Note: If the range is not currently within a block, the result will 1412 * depend on the {@param blockTag } 1413 * 1. Establish one new block element of the specified tag name before split; 1414 * 2. Just split up the surrounding blockLimit element unless it's already inside <body>. 1415 * @param {String} blockTag The tag name 1416 */ 1408 1417 splitBlock : function( blockTag ) 1409 1418 { 1410 1419 var startPath = new CKEDITOR.dom.elementPath( this.startContainer ), … … 1413 1422 var startBlockLimit = startPath.blockLimit, 1414 1423 endBlockLimit = endPath.blockLimit; 1415 1424 1416 var startBlock = startPath.block ,1417 endBlock = endPath.block ;1425 var startBlock = startPath.block || !blockTag && startBlockLimit, 1426 endBlock = endPath.block || !blockTag && endBlockLimit; 1418 1427 1419 1428 var elementPath = null; 1429 1420 1430 // Do nothing if the boundaries are in different block limits. 1421 if ( !startBlockLimit.equals( endBlockLimit ) )1431 if ( blockTag && !startBlockLimit.equals( endBlockLimit ) ) 1422 1432 return null; 1433 // Don't split <body>. 1434 else if( !blockTag && ( startBlock.is( 'body' ) || endBlock.is( 'body' ) ) ) 1435 return null; 1423 1436 1424 1437 // Get or fix current blocks. 1425 1438 if ( blockTag != 'br' ) … … 1473 1486 1474 1487 // In Gecko, the last child node must be a bogus <br>. 1475 1488 // Note: bogus <br> added under <ul> or <ol> would cause 1476 // lists to be incorrectly rendered. 1477 if ( !CKEDITOR.env.ie && !startBlock.is( 'ul', 'ol') ) 1478 startBlock.appendBogus() ; 1479 } 1480 } 1489 // lists to be incorrectly rendered, and <br> under <tr> 1490 // or <tbody> will bring inconsistency output among browsers. 1491 if ( !CKEDITOR.env.ie ) 1492 { 1493 var dtd = CKEDITOR.dtd[ startBlock.getName() ]; 1494 dtd[ 'br' ] && startBlock.appendBogus() ; 1495 } 1496 } 1497 } 1481 1498 1482 1499 return { 1483 1500 previousBlock : startBlock, -
_source/core/htmlparser/fragment.js
345 345 346 346 checkPending(); 347 347 348 if ( fixForBody && !currentNode.type )348 if ( fixForBody && CKEDITOR.tools.trim( text ) && !currentNode.type ) 349 349 this.onTagOpen( fixForBody, {} ); 350 350 351 351 // Shrinking consequential spaces into one single for all elements