Ticket #4781: 4781_5.patch

File 4781_5.patch, 4.2 KB (added by Frederico Caldeira Knabben, 14 years ago)
  • _source/core/dom/range.js

     
    15991599                 * element. For example, in an element tree like
    16001600                 * "<p><b><i></i></b> Text</p>", the start editing point is
    16011601                 * "<p><b><i>^</i></b> Text</p>" (inside <i>).
    1602                  * @param {CKEDITOR.dom.element} targetElement The element into which
    1603                  *              look for the editing spot.
     1602                 * @param {CKEDITOR.dom.element} el The element into which look for the
     1603                 *              editing spot.
    16041604                 */
    1605                 moveToElementEditStart : function( targetElement )
     1605                moveToElementEditStart : function( el )
    16061606                {
    1607                         var editableElement;
     1607                        var isEditable;
    16081608
    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 )
    16101619                        {
    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                                }
    16171644                        }
    16181645
    1619                         if ( editableElement )
    1620                         {
    1621                                 this.moveToPosition(editableElement, CKEDITOR.POSITION_AFTER_START);
    1622                                 return true;
    1623                         }
    1624                         else
    1625                                 return false;
     1646                        return isEditable;
    16261647                },
    16271648
    16281649                /**
  • _source/core/dom/walker.js

     
    4747                        {
    4848                                return ( ( !movingOut || !limitLTR.equals( node ) )
    4949                                        && ( !blockerLTR || !node.equals( blockerLTR ) )
    50                                         && ( node.type != CKEDITOR.NODE_ELEMENT || node.getName() != 'body' ) );
     50                                        && ( node.type != CKEDITOR.NODE_ELEMENT || !movingOut || node.getName() != 'body' ) );
    5151                        };
    5252                }
    5353
     
    6262                        {
    6363                                return ( ( !movingOut || !limitRTL.equals( node ) )
    6464                                        && ( !blockerRTL || !node.equals( blockerRTL ) )
    65                                         && ( node.type != CKEDITOR.NODE_ELEMENT || node.getName() != 'body' ) );
     65                                        && ( node.type != CKEDITOR.NODE_ELEMENT || !movingOut || node.getName() != 'body' ) );
    6666                        };
    6767                }
    6868
     
    7878                                if ( stopGuard( node, movingOut ) === false )
    7979                                        return false;
    8080
    81                                 return userGuard( node );
     81                                return userGuard( node, movingOut );
    8282                        };
    8383                }
    8484                else
     
    396396        };
    397397
    398398        /**
    399          * Whether the node contains only white-spaces characters.
     399         * Whether the node is a text node containing only whitespaces characters.
    400400         * @param isReject
    401401         */
    402402        CKEDITOR.dom.walker.whitespaces = function( isReject )
  • _source/core/dtd.js

     
    6666                 */
    6767                $block : block,
    6868
     69                $inline : L,    // Just like span.
     70
    6971                $body : X({script:1}, block),
    7072
    7173                $cdata : {script:1,style:1},
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy