Ticket #7645: 7645.patch

File 7645.patch, 2.7 KB (added by Sa'ar Zac Elias, 13 years ago)
  • _source/core/dom/range.js

     
    20072007                                return container ;
    20082008
    20092009                        return container.getChild( this.endOffset - 1 ) || container ;
    2010                 }
     2010                },
     2011
     2012                // Fix list selection range where entire range is selected from the inner side.
     2013                // <ul><li>[...]</li></ul> =>   [<ul><li>...</li></ul>]
     2014                // <ul>[<li></li><li><ul><li></li>]</ul></li></ul> => [<ul><li></li><li><ul><li></li></ul></li></ul>]
     2015                fixListRange : (function()
     2016                {
     2017                        function getTopmost( node, end )
     2018                        {
     2019                                var parent,
     2020                                        savedNode = null;
     2021                                while ( node && ( parent = node.getParent() ) && !parent.is( 'html' ) &&
     2022                                        this.checkBoundaryOfElement( node, end ? CKEDITOR.END : CKEDITOR.START ) &&
     2023                                        node.equals( parent[ end ? 'getLast' : 'getFirst' ]( CKEDITOR.dom.walker.nodeType( CKEDITOR.NODE_ELEMENT ) ) ) )
     2024                                {
     2025                                        savedNode = node;
     2026                                        node = parent;
     2027                                }
     2028                                return savedNode;
     2029                        }
     2030
     2031                        return function()
     2032                        {
     2033                                var startRoot = getTopmost.call( this, this.startContainer.getAscendant( 'li', 1 ) ),
     2034                                        endRoot = getTopmost.call( this, this.endContainer.getAscendant( 'li', 1 ), 1 );
     2035
     2036                                if ( startRoot && endRoot && startRoot.equals( endRoot ) )
     2037                                {
     2038                                        this.setStartAt( startRoot, CKEDITOR.POSITION_BEFORE_START );
     2039                                        this.setEndAt( startRoot, CKEDITOR.POSITION_AFTER_END );
     2040                                        this.select();
     2041                                }
     2042                        };
     2043                })()
    20112044        };
    20122045})();
    20132046
  • _source/plugins/wysiwygarea/plugin.js

     
    749749                                                                if ( keyCode in { 8 : 1, 46 : 1 } )
    750750                                                                {
    751751                                                                        var sel = editor.getSelection(),
    752                                                                                 control = sel.getSelectedElement();
     752                                                                                control = sel && sel.getSelectedElement(),
     753                                                                                range = sel && sel.getRanges()[ 0 ];
    753754
    754755                                                                        if ( control )
    755756                                                                        {
     
    758759
    759760                                                                                // Delete any element that 'hasLayout' (e.g. hr,table) in IE8 will
    760761                                                                                // break up the selection, safely manage it here. (#4795)
    761                                                                                 var bookmark = sel.getRanges()[ 0 ].createBookmark();
     762                                                                                var bookmark = range.createBookmark();
    762763                                                                                // Remove the control manually.
    763764                                                                                control.remove();
    764765                                                                                sel.selectBookmarks( [ bookmark ] );
     
    767768
    768769                                                                                evt.data.preventDefault();
    769770                                                                        }
     771
     772                                                                        // Handle cases of full-list selection from the inner side on delete (#7645).
     773                                                                        range && range.fixListRange();
    770774                                                                }
    771775                                                        } );
    772776
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy