Ticket #6005: 6005.patch
File 6005.patch, 4.1 KB (added by , 14 years ago) |
---|
-
_source/core/dom/range.js
1632 1632 }, 1633 1633 1634 1634 /** 1635 * Check whether current range is on the inner edge of the specified element.1636 * @param {Number} checkType ( CKEDITOR.START | CKEDITOR.END ) The checking side.1635 * Check whether a range boundary is at the inner boundary of a given 1636 * element. 1637 1637 * @param {CKEDITOR.dom.element} element The target element to check. 1638 * @param {Number} checkType The boundary to check for both the range 1639 * and the element. It can be CKEDITOR.START or CKEDITOR.END. 1640 * @returns {Boolean} "true" if the range boundary is at the inner 1641 * boundary of the element. 1638 1642 */ 1639 1643 checkBoundaryOfElement : function( element, checkType ) 1640 1644 { 1645 var checkStart = ( checkType == CKEDITOR.START ); 1646 1647 // Create a copy of this range, so we can manipulate it for our checks. 1641 1648 var walkerRange = this.clone(); 1649 1650 // Collapse the range at the proper size. 1651 walkerRange.collapse( checkStart ); 1652 1642 1653 // Expand the range to element boundary. 1643 walkerRange[ checkType == CKEDITOR.START ? 1644 'setStartAt' : 'setEndAt' ] 1645 ( element, checkType == CKEDITOR.START ? 1646 CKEDITOR.POSITION_AFTER_START 1647 : CKEDITOR.POSITION_BEFORE_END ); 1654 walkerRange[ checkStart ? 'setStartAt' : 'setEndAt' ] 1655 ( element, checkStart ? CKEDITOR.POSITION_AFTER_START : CKEDITOR.POSITION_BEFORE_END ); 1648 1656 1657 // Create the walker, which will check if we have anything useful 1658 // in the range. 1649 1659 var walker = new CKEDITOR.dom.walker( walkerRange ); 1650 1660 walker.evaluator = elementBoundaryEval; 1651 return walker[ checkType == CKEDITOR.START ? 1652 1661 1662 return walker[ checkStart ? 'checkBackward' : 'checkForward' ](); 1653 1663 }, 1654 1664 1655 1665 // Calls to this function may produce changes to the DOM. The range may -
_source/plugins/styles/plugin.js
582 582 583 583 if ( this.checkElementRemovable( element ) ) 584 584 { 585 var endOfElement = range.checkBoundaryOfElement( element, CKEDITOR.END ), 586 startOfElement = !endOfElement && range.checkBoundaryOfElement( element, CKEDITOR.START ); 587 if ( startOfElement || endOfElement ) 585 var isStart; 586 587 if ( range.collapsed && ( 588 range.checkBoundaryOfElement( element, CKEDITOR.END ) || 589 ( isStart = range.checkBoundaryOfElement( element, CKEDITOR.START ) ) ) ) 588 590 { 589 591 boundaryElement = element; 590 boundaryElement.match = startOfElement ? 'start' : 'end';592 boundaryElement.match = isStart ? 'start' : 'end'; 591 593 } 592 594 else 593 595 { -
_source/plugins/wysiwygarea/plugin.js
45 45 selection.unlock(); 46 46 47 47 var $sel = selection.getNative(); 48 49 // Delete control selections to avoid IE bugs on pasteHTML. 48 50 if ( $sel.type == 'Control' ) 49 51 $sel.clear(); 52 else if ( selection.getType() == CKEDITOR.SELECTION_TEXT ) 53 { 54 // Due to IE bugs on handling contenteditable=false blocks 55 // (#6005), we need to make some checks and eventually 56 // delete the selection first. 57 58 var range = selection.getRanges()[0], 59 endContainer = range && range.endContainer; 60 61 if ( endContainer && 62 endContainer.type == CKEDITOR.NODE_ELEMENT && 63 endContainer.getAttribute( 'contenteditable' ) == 'false' && 64 range.checkBoundaryOfElement( endContainer, CKEDITOR.END ) ) 65 { 66 range.setEndAfter( range.endContainer ); 67 range.deleteContents(); 68 } 69 } 70 50 71 $sel.createRange().pasteHTML( data ); 51 72 52 73 if ( selIsLocked )