Ticket #8950: 8950_3.patch

File 8950_3.patch, 4.1 KB (added by Garry Yao, 12 years ago)
  • _source/plugins/wysiwygarea/plugin.js

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    267267                        {
    268268                                range.moveToPosition( lastElement, CKEDITOR.POSITION_AFTER_END );
    269269
    270                                 // If we're inserting a block element immediatelly followed by
    271                                 // another block element, the selection must move there. (#3100,#5436)
     270                                // If we're inserting a block element immediately followed by
     271                                // another block element, the selection must be optimized. (#3100,#5436,#8950)
    272272                                if ( isBlock )
    273273                                {
    274274                                        var next = lastElement.getNext( notWhitespaceEval ),
    275275                                                nextName = next && next.type == CKEDITOR.NODE_ELEMENT && next.getName();
    276276
    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 );
     277                                        if ( nextName && CKEDITOR.dtd.$block[ nextName ] )
     278                                        {
     279                                                // If the next one is a text block, move cursor to after the start of it.
     280                                                if ( CKEDITOR.dtd[ nextName ]['#'] )
     281                                                        range.moveToElementEditStart( next );
     282                                                // Otherwise move cursor to the before end of the last element.
     283                                                else
     284                                                        range.moveToElementEditEnd( lastElement );
     285                                        }
     286                                        // Create a new empty block for moving cursor into it.
     287                                        else if ( !next )
     288                                                range.fixBlock( true, this.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p'  );
    280289                                }
    281290                        }
    282291
  • _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