Ticket #8950: 8950_5.patch

File 8950_5.patch, 5.2 KB (added by Garry Yao, 12 years ago)
  • _source/core/dom/walker.js

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    446446                };
    447447        };
    448448
    449         CKEDITOR.dom.walker.bogus = function( type, isReject )
     449        CKEDITOR.dom.walker.bogus = function( isReject )
    450450        {
    451451                function nonEmpty( node )
    452452                {
  • _source/plugins/wysiwygarea/plugin.js

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    1313        // Matching an empty paragraph at the end of document.
    1414        var emptyParagraphRegexp = /(^|<body\b[^>]*>)\s*<(p|div|address|h\d|center|pre)[^>]*>\s*(?:<br[^>]*>|&nbsp;|\u00A0|&#160;)?\s*(:?<\/\2>)?\s*(?=$|<\/body>)/gi;
    1515
    16         var notWhitespaceEval = CKEDITOR.dom.walker.whitespaces( true );
     16        var notWhitespaceEval = CKEDITOR.dom.walker.whitespaces( true ),
     17          notBogus = CKEDITOR.dom.walker.bogus( true ),
     18          notEmpty = function( node ) { return notWhitespaceEval( node ) && notBogus( node ); };
    1719
    1820        // Elements that could blink the cursor anchoring beside it, like hr, page-break. (#6554)
    1921        function nonEditable( element )
     
    267269                        {
    268270                                range.moveToPosition( lastElement, CKEDITOR.POSITION_AFTER_END );
    269271
    270                                 // If we're inserting a block element immediatelly followed by
    271                                 // another block element, the selection must move there. (#3100,#5436)
     272                                // If we're inserting a block element immediately followed by
     273                                // another block element, the selection must be optimized. (#3100,#5436,#8950)
    272274                                if ( isBlock )
    273275                                {
    274                                         var next = lastElement.getNext( notWhitespaceEval ),
     276                                        var next = lastElement.getNext( notEmpty ),
    275277                                                nextName = next && next.type == CKEDITOR.NODE_ELEMENT && next.getName();
    276278
    277                                         // Check if it's a block element that accepts text.
    278                                         if ( nextName && CKEDITOR.dtd.$block[ nextName ] && CKEDITOR.dtd[ nextName ]['#'] )
    279                                                 range.moveToElementEditStart( next );
     279                                        // If the next one is a text block, move cursor to the start of it's content.
     280                                        if ( nextName && CKEDITOR.dtd.$block[ nextName ] )
     281                                        {
     282                                                if ( CKEDITOR.dtd[ nextName ][ '#' ] )
     283                                                        range.moveToElementEditStart( next );
     284                                                // Otherwise move cursor to the before end of the last element.
     285                                                else
     286                                                        range.moveToElementEditEnd( lastElement );
     287                                        }
     288                                        // Append new block the inserted is already the last element of parent.
     289                                        else if ( !next )
     290                                                range.fixBlock( true, this.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p'  );
    280291                                }
    281292                        }
    282293
  • _source/core/dom/element.js

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    736736                                        || this.getComputedStyle( 'display' ) == 'none'
    737737                                        || this.getComputedStyle( 'visibility' ) == 'hidden'
    738738                                        || this.is( 'a' ) && this.data( 'cke-saved-name' ) && !this.getChildCount()
    739                                         || CKEDITOR.dtd.$nonEditable[ name ] )
     739                                        || CKEDITOR.dtd.$nonEditable[ name ]
     740                                        || CKEDITOR.dtd.$empty[ name ] )
    740741                        {
    741742                                return false;
    742743                        }
  • _source/core/dom/range.js

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    513513                        if ( serializable )
    514514                        {
    515515                                baseId = 'cke_bm_' + CKEDITOR.tools.getNextNumber();
    516                                 startNode.setAttribute( 'id', baseId + 'S' );
     516                                startNode.setAttribute( 'id', baseId + ( collapsed ? 'C' : 'S' ) );
    517517                        }
    518518
    519519                        // If collapsed, the endNode will not be created.
     
    544544                                this.moveToPosition( startNode, CKEDITOR.POSITION_AFTER_END );
    545545
    546546                        return {
    547                                 startNode : serializable ? baseId + 'S' : startNode,
     547                                startNode : serializable ? baseId + ( collapsed ? 'C' : 'S' ) : startNode,
    548548                                endNode : serializable ? baseId + 'E' : endNode,
    549549                                serializable : serializable,
    550550                                collapsed : collapsed
     
    19381938                        {
    19391939                                var next;
    19401940
    1941                                 if ( node.type == CKEDITOR.NODE_ELEMENT
    1942                                                 && node.isEditable( false )
    1943                                                 && !CKEDITOR.dtd.$nonEditable[ node.getName() ] )
    1944                                 {
     1941                                if ( node.type == CKEDITOR.NODE_ELEMENT && node.isEditable( false ) )
    19451942                                        next = node[ isMoveToEnd ? 'getLast' : 'getFirst' ]( nonWhitespaceOrBookmarkEval );
    1946                                 }
    19471943
    19481944                                if ( !childOnly && !next )
    19491945                                        next = node[ isMoveToEnd ? 'getPrevious' : 'getNext' ]( nonWhitespaceOrBookmarkEval );
    19501946
    19511947                                return next;
     1948                        }
     1949
     1950                        // Handle non-editable element e.g. HR.
     1951                        if ( el.type == CKEDITOR.NODE_ELEMENT && !el.isEditable( false ) )
     1952                        {
     1953                                this.moveToPosition( el, isMoveToEnd ?
     1954                                                                                 CKEDITOR.POSITION_AFTER_END :
     1955                                                                                 CKEDITOR.POSITION_BEFORE_START );
     1956                                return true;
    19521957                        }
    19531958
    19541959                        var found = 0;
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy