Ticket #5079: 5079.patch
File 5079.patch, 3.7 KB (added by , 14 years ago) |
---|
-
_source/plugins/pagebreak/plugin.js
82 82 // Creates the fake image used for this element. 83 83 breakObject = editor.createFakeElement( breakObject, 'cke_pagebreak', 'div' ); 84 84 85 var ranges = editor.getSelection().getRanges(); 85 var selection = editor.getSelection(), 86 ranges = selection.getRanges(), 87 range; 86 88 87 for ( var range, i = 0 ; i < ranges.length; i++ )89 for ( var i = 0; i < ranges.length; i++ ) 88 90 { 89 91 range = ranges[ i ]; 92 range.deleteContents(); 90 93 91 if ( i > 0 ) 92 breakObject = breakObject.clone( true ); 94 // Split up all the blocks until to order to insert page-break inside 'BODY'. (#5079) 95 var current; 96 while ( !( current = range.getCommonAncestor( false, true ) ).is( 'body' ) ) 97 range.splitBlock(); 93 98 94 range.splitBlock( 'p' );95 99 range.insertNode( breakObject ); 100 range.moveToElementEditStart( breakObject.getNext() ||breakObject.getPrevious() ); 96 101 } 102 103 selection.selectRanges( ranges ); 97 104 } 98 105 }; -
_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 }; 13 13 14 14 // Check if an element contains any block element. 15 15 var checkHasBlock = function( element ) -
_source/core/dom/range.js
1420 1420 return fixedBlock; 1421 1421 }, 1422 1422 1423 /** 1424 * Split the occupied block into two, putting the new cursor position between them. 1425 * Note: If the range is not already inside a block, the result will 1426 * depend on {@param blockTag }: 1427 * 1. Establish one new block element of the specified tag name before split; 1428 * 2. Split up the any surrounding blockLimit element besides 'BODY'. 1429 * @param {String} blockTag The tag name 1430 */ 1423 1431 splitBlock : function( blockTag ) 1424 1432 { 1425 1433 var startPath = new CKEDITOR.dom.elementPath( this.startContainer ), … … 1428 1436 var startBlockLimit = startPath.blockLimit, 1429 1437 endBlockLimit = endPath.blockLimit; 1430 1438 1431 var startBlock = startPath.block ,1432 endBlock = endPath.block ;1439 var startBlock = startPath.block || !blockTag && startBlockLimit, 1440 endBlock = endPath.block || !blockTag && endBlockLimit; 1433 1441 1434 1442 var elementPath = null; 1443 1435 1444 // Do nothing if the boundaries are in different block limits. 1436 if ( !startBlockLimit.equals( endBlockLimit ) )1445 if ( blockTag && !startBlockLimit.equals( endBlockLimit ) ) 1437 1446 return null; 1447 // Don't split <body>. 1448 else if( !blockTag && ( startBlock.is( 'body' ) || endBlock.is( 'body' ) ) ) 1449 return null; 1438 1450 1439 1451 // Get or fix current blocks. 1440 1452 if ( blockTag != 'br' ) … … 1480 1492 // lists to be incorrectly rendered. 1481 1493 if ( !CKEDITOR.env.ie && !startBlock.is( 'ul', 'ol') ) 1482 1494 startBlock.appendBogus() ; 1483 }1484 }1495 } 1496 } 1485 1497 1486 1498 return { 1487 1499 previousBlock : startBlock,