Ticket #3849: 3849.patch

File 3849.patch, 2.9 KB (added by Martin Kou, 15 years ago)
  • _source/plugins/selection/plugin.js

     
    943943                function()
    944944                {
    945945                        var collapsed = this.collapsed;
    946                         var isStartMakerAlone;
     946                        var isStartMarkerAlone;
    947947                        var dummySpan;
    948948
    949949                        var bookmark = this.createBookmark();
     
    976976                        }
    977977                        else
    978978                        {
    979 // The isStartMakerAlone logic comes from V2. It guarantees that the lines
    980 // will expand and that the cursor will be blinking on the right place.
    981 // Actually, we are using this flag just to avoid using this hack in all
    982 // situations, but just on those needed.
     979                                // The isStartMarkerAlone logic comes from V2. It guarantees that the lines
     980                                // will expand and that the cursor will be blinking on the right place.
     981                                // Actually, we are using this flag just to avoid using this hack in all
     982                                // situations, but just on those needed.
     983                                isStartMarkerAlone = !startNode.hasPrevious() || ( startNode.getPrevious().is && startNode.getPrevious().is( 'br' ) );
    983984
    984 // But, in V3, somehow it is not interested on working whe hitting SHIFT+ENTER
    985 // inside text. So, let's jsut leave the hack happen always.
    986 
    987 // I'm still leaving the code here just in case. We may find some other IE
    988 // weirdness and uncommenting this stuff may be useful.
    989 
    990 //                              isStartMakerAlone = ( !startNode.hasPrevious() || ( startNode.getPrevious().is && startNode.getPrevious().is( 'br' ) ) )
    991 //                                      && !startNode.hasNext();
    992 
    993985                                // Append a temporary <span>&#65279;</span> before the selection.
    994986                                // This is needed to avoid IE destroying selections inside empty
    995987                                // inline elements, like <b></b> (#253).
     
    999991                                dummySpan.setHtml( '&#65279;' );        // Zero Width No-Break Space (U+FEFF). See #1359.
    1000992                                dummySpan.insertBefore( startNode );
    1001993
    1002 //                              if ( isStartMakerAlone )
    1003 //                              {
     994                                if ( isStartMarkerAlone )
     995                                {
    1004996                                        // To expand empty blocks or line spaces after <br>, we need
    1005997                                        // instead to have any char, which will be later deleted using the
    1006998                                        // selection.
    1007999                                        // \ufeff = Zero Width No-Break Space (U+FEFF). (#1359)
    10081000                                        this.document.createText( '\ufeff' ).insertBefore( startNode );
    1009 //                              }
     1001                                }
    10101002                        }
    10111003
    10121004                        // Remove the markers (reset the position, because of the changes in the DOM tree).
     
    10151007
    10161008                        if ( collapsed )
    10171009                        {
    1018 //                              if ( isStartMakerAlone )
    1019 //                              {
     1010                                if ( isStartMarkerAlone )
     1011                                {
    10201012                                        // Move the selection start to include the temporary \ufeff.
    10211013                                        ieRange.moveStart( 'character', -1 );
    10221014
     
    10241016
    10251017                                        // Remove our temporary stuff.
    10261018                                        this.document.$.selection.clear();
    1027 //                              }
    1028 //                              else
    1029 //                                      ieRange.select();
     1019                                }
     1020                                else
     1021                                        ieRange.select();
    10301022
    10311023                                dummySpan.remove();
    10321024                        }
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy