Ticket #4738: 4738.patch

File 4738.patch, 2.9 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/wysiwygarea/plugin.js

     
    8888                                                        && ( dtd = CKEDITOR.dtd[ current.getName() ] )
    8989                                                        && !( dtd && dtd [ elementName ] ) )
    9090                                        {
     91                                                // Split up inline elements.
     92                                                if( current.getName() in CKEDITOR.dtd.span )
     93                                                        range.splitElement( current );
    9194                                                // If we're in an empty block which indicate a new paragraph,
    9295                                                // simply replace it with the inserting block.(#3664)
    93                                                 if ( range.checkStartOfBlock()
     96                                                else if ( range.checkStartOfBlock()
    9497                                                         && range.checkEndOfBlock() )
    9598                                                {
    9699                                                        range.setStartBefore( current );
  • _source/core/dom/range.js

     
    14581458                                }
    14591459                                else
    14601460                                {
    1461                                         // Extract the contents of the block from the selection point to the end
    1462                                         // of its contents.
    1463                                         this.setEndAt( startBlock, CKEDITOR.POSITION_BEFORE_END );
    1464                                         var documentFragment = this.extractContents();
    1465 
    1466                                         // Duplicate the block element after it.
    1467                                         endBlock = startBlock.clone( false );
    1468 
    1469                                         // Place the extracted contents into the duplicated block.
    1470                                         documentFragment.appendTo( endBlock );
    1471                                         endBlock.insertAfter( startBlock );
    1472                                         this.moveToPosition( startBlock, CKEDITOR.POSITION_AFTER_END );
    1473 
     1461                                        this.splitElement( startBlock );
    14741462                                        // In Gecko, the last child node must be a bogus <br>.
    14751463                                        // Note: bogus <br> added under <ul> or <ol> would cause
    14761464                                        // lists to be incorrectly rendered.
     
    14891477                },
    14901478
    14911479                /**
     1480                 * Branch the specified element from the collapsed range position and
     1481                 * place the caret between the two result branches.
     1482                 * Note: The range must be collapsed and been enclosed by this element.
     1483                 * @param {CKEDITOR.dom.element} element
     1484                 */
     1485                splitElement : function( toSplit )
     1486                {
     1487                        if( !this.collapsed )
     1488                                return;
     1489
     1490                        // Extract the contents of the block from the selection point to the end
     1491                        // of its contents.
     1492                        this.setEndAt( toSplit, CKEDITOR.POSITION_BEFORE_END );
     1493                        var documentFragment = this.extractContents();
     1494
     1495                        // Duplicate the element after it.
     1496                        var clone = toSplit.clone( false );
     1497
     1498                        // Place the extracted contents into the duplicated element.
     1499                        documentFragment.appendTo( clone );
     1500                        clone.insertAfter( toSplit );
     1501                        this.moveToPosition( toSplit, CKEDITOR.POSITION_AFTER_END );
     1502                },
     1503
     1504                /**
    14921505                 * Check whether current range is on the inner edge of the specified element.
    14931506                 * @param {Number} checkType ( CKEDITOR.START | CKEDITOR.END ) The checking side.
    14941507                 * @param {CKEDITOR.dom.element} element The target element to check.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy