Ticket #4781: 4781_5.patch
File 4781_5.patch, 4.2 KB (added by , 14 years ago) |
---|
-
_source/core/dom/range.js
1599 1599 * element. For example, in an element tree like 1600 1600 * "<p><b><i></i></b> Text</p>", the start editing point is 1601 1601 * "<p><b><i>^</i></b> Text</p>" (inside <i>). 1602 * @param {CKEDITOR.dom.element} targetElement The element into which1603 * look for theediting spot.1602 * @param {CKEDITOR.dom.element} el The element into which look for the 1603 * editing spot. 1604 1604 */ 1605 moveToElementEditStart : function( targetElement)1605 moveToElementEditStart : function( el ) 1606 1606 { 1607 var editableElement;1607 var isEditable; 1608 1608 1609 while ( targetElement && targetElement.type == CKEDITOR.NODE_ELEMENT ) 1609 var whitespaceEval = new CKEDITOR.dom.walker.whitespaces(), 1610 bookmarkEval = new CKEDITOR.dom.walker.bookmark(); 1611 1612 var evaluator = function( node ) 1613 { 1614 // Whitespaces and bookmark nodes are to be ignored. 1615 return ( !whitespaceEval( node ) && !bookmarkEval( node ) ); 1616 }; 1617 1618 while ( el && el.type == CKEDITOR.NODE_ELEMENT ) 1610 1619 { 1611 if ( targetElement.isEditable() ) 1612 editableElement = targetElement; 1613 else if ( editableElement ) 1614 break ; // If we already found an editable element, stop the loop. 1615 1616 targetElement = targetElement.getFirst(); 1620 isEditable = el.isEditable(); 1621 1622 // If an editable element is found, move inside it. 1623 if ( isEditable ) 1624 this.moveToPosition( el, CKEDITOR.POSITION_AFTER_START ); 1625 // Stop immediately if we've found a non editable inline element (e.g <img>). 1626 else if ( CKEDITOR.dtd.$inline[ el.getName() ] ) 1627 { 1628 this.moveToPosition( el, CKEDITOR.POSITION_BEFORE_START ); 1629 return true; 1630 } 1631 1632 // Non-editable non-inline elements are to be bypassed, getting the next one. 1633 if ( CKEDITOR.dtd.$empty[ el.getName() ] ) 1634 el = el.getNext( evaluator ); 1635 else 1636 el = el.getFirst( evaluator ); 1637 1638 // Stop immediately if we've found a text node. 1639 if ( el && el.type == CKEDITOR.NODE_TEXT ) 1640 { 1641 this.moveToPosition( el, CKEDITOR.POSITION_BEFORE_START ); 1642 return true; 1643 } 1617 1644 } 1618 1645 1619 if ( editableElement ) 1620 { 1621 this.moveToPosition(editableElement, CKEDITOR.POSITION_AFTER_START); 1622 return true; 1623 } 1624 else 1625 return false; 1646 return isEditable; 1626 1647 }, 1627 1648 1628 1649 /** -
_source/core/dom/walker.js
47 47 { 48 48 return ( ( !movingOut || !limitLTR.equals( node ) ) 49 49 && ( !blockerLTR || !node.equals( blockerLTR ) ) 50 && ( node.type != CKEDITOR.NODE_ELEMENT || node.getName() != 'body' ) );50 && ( node.type != CKEDITOR.NODE_ELEMENT || !movingOut || node.getName() != 'body' ) ); 51 51 }; 52 52 } 53 53 … … 62 62 { 63 63 return ( ( !movingOut || !limitRTL.equals( node ) ) 64 64 && ( !blockerRTL || !node.equals( blockerRTL ) ) 65 && ( node.type != CKEDITOR.NODE_ELEMENT || node.getName() != 'body' ) );65 && ( node.type != CKEDITOR.NODE_ELEMENT || !movingOut || node.getName() != 'body' ) ); 66 66 }; 67 67 } 68 68 … … 78 78 if ( stopGuard( node, movingOut ) === false ) 79 79 return false; 80 80 81 return userGuard( node );81 return userGuard( node, movingOut ); 82 82 }; 83 83 } 84 84 else … … 396 396 }; 397 397 398 398 /** 399 * Whether the node contains only white-spaces characters.399 * Whether the node is a text node containing only whitespaces characters. 400 400 * @param isReject 401 401 */ 402 402 CKEDITOR.dom.walker.whitespaces = function( isReject ) -
_source/core/dtd.js
66 66 */ 67 67 $block : block, 68 68 69 $inline : L, // Just like span. 70 69 71 $body : X({script:1}, block), 70 72 71 73 $cdata : {script:1,style:1},