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 | })() |