Ticket #2797: 2797.patch

File 2797.patch, 2.6 KB (added by Martin Kou, 15 years ago)
  • _source/core/dom/domwalker.js

     
    219219        {
    220220                return CKEDITOR.dom.domWalker.blockBoundary( { br : 1 } );
    221221        };
     222
     223        CKEDITOR.dom.domWalker.inlineElements = function( evt )
     224        {
     225                if ( evt.data.type != 'up' )
     226                {
     227                        this.stop();
     228                        evt.stop();
     229                        return;
     230                }
     231
     232                var to = evt.data.to;
     233                if ( to.getComputedStyle( 'display' ) != 'inline' )
     234                {
     235                        this.stop();
     236                        evt.stop();
     237                        return;
     238                }
     239        }
    222240})();
  • _source/core/dom/range.js

     
    968968
    969969                                case CKEDITOR.ENLARGE_BLOCK_CONTENTS:
    970970                                case CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS:
     971                                case CKEDITOR.ENLARGE_INLINE_ELEMENTS:
    971972                                        // DFS backward to get the block/list item boundary at or before the start.
    972973                                        var boundaryNodes = getBoundaryNodes.apply( this ),
    973974                                                startNode = boundaryNodes.startNode,
    974975                                                endNode = boundaryNodes.endNode,
    975                                                 guardFunction = ( unit == CKEDITOR.ENLARGE_BLOCK_CONTENTS ?
    976                                                         CKEDITOR.dom.domWalker.blockBoundary() :
    977                                                         CKEDITOR.dom.domWalker.listItemBoundary() ),
    978                                                 walker = new CKEDITOR.dom.domWalker( startNode ),
     976                                                guardFunction;
     977
     978                                        if ( unit == CKEDITOR.ENLARGE_BLOCK_CONTENTS )
     979                                                guardFunction = CKEDITOR.dom.domWalker.blockBoundary();
     980                                        else if ( unit == CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS )
     981                                                guardFunction = CKEDITOR.dom.domWalker.listItemBoundary();
     982                                        else
     983                                                guardFunction = CKEDITOR.dom.domWalker.inlineElements;
     984
     985                                        var walker = new CKEDITOR.dom.domWalker( startNode ),
    979986                                                data = walker.reverse( guardFunction ),
    980987                                                boundaryEvent = data.events.shift();
    981988
     
    13041311CKEDITOR.ENLARGE_ELEMENT = 1;
    13051312CKEDITOR.ENLARGE_BLOCK_CONTENTS = 2;
    13061313CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS = 3;
     1314CKEDITOR.ENLARGE_INLINE_ELEMENTS = 4;
  • _source/plugins/styles/plugin.js

     
    223223                var bookmark = range.createBookmark();
    224224
    225225                // Expand the range.
    226                 range.enlarge( CKEDITOR.ENLARGE_ELEMENT );
     226                range.enlarge( CKEDITOR.ENLARGE_INLINE_ELEMENTS );
    227227                range.trim();
    228228
    229229                // Get the first node to be processed and the last, which concludes the
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy