Ticket #8617: 8617_1.patch

File 8617_1.patch, 1.3 KB (added by Jakub Ś, 12 years ago)

Character which caused editor not to load was removed.

  • _source/plugins/selection/plugin.js

     
    162162                var fillingChar = doc && doc.removeCustomData( 'cke-fillingChar' );
    163163                if ( fillingChar )
    164164                {
     165                        var bm,
     166                        sel = doc.getSelection(),
     167                        nativeSel = sel.getNative();
     168
     169                        // Text selection position might get mangled by
     170                        // subsequent dom modification. #8617[1]
     171                        if ( nativeSel.anchorNode === fillingChar.$ )
     172                        {
     173                                bm = sel.createBookmarks2()[ 0 ];
     174                                // Anticipate the removed char.
     175                                bm.startOffset--;
     176
     177                                if ( !nativeSel.isCollpased
     178                                         && nativeSel.focusNode == fillingChar.$ )
     179                                                bm.endOffset--;
     180                        }
     181
    165182                        // We can't simply remove the filling node because the user
    166183                        // will actually enlarge it when typing, so we just remove the
    167184                        // invisible char from it.
    168185                        fillingChar.setText( fillingChar.getText().replace( /\u200B/g, '' ) );
    169                         fillingChar = 0;
     186
     187                        // Restore the text selection afterward. #8617(2)
     188                        bm && sel.selectBookmarks( [ bm ] );
    170189                }
    171190        }
    172191
     
    17241743                        {
    17251744                                this.document.getSelection().selectRanges( [ this ] );
    17261745                        };
    1727 } )();
     1746} )();
     1747 No newline at end of file
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy