Ticket #4795: 4795_2.patch

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

     
    475475
    476476                                                if ( CKEDITOR.env.ie )
    477477                                                {
    478                                                         // Cancel default action for backspace in IE on control types. (#4047)
     478                                                        // Override keystrokes which should have deletion behavior
     479                                                        //  on control types in IE . (#4047)
    479480                                                        domDocument.on( 'keydown', function( evt )
    480481                                                        {
    481                                                                 // Backspace.
    482                                                                 var control = evt.data.getKeystroke() == 8
    483                                                                                           && editor.getSelection().getSelectedElement();
    484                                                                 if ( control )
    485                                                                 {
    486                                                                         // Make undo snapshot.
    487                                                                         editor.fire( 'saveSnapshot' );
    488                                                                         // Remove manually.
    489                                                                         control.remove();
    490                                                                         editor.fire( 'saveSnapshot' );
    491                                                                         evt.cancel();
    492                                                                 }
     482                                                                var keyCode = evt.data.getKeystroke();
     483
     484                                                                // Backspace OR Delete.
     485                                                                if( keyCode in { 8 : 1, 46 : 1 } )
     486                                                                {
     487                                                                        var sel = editor.getSelection(),
     488                                                                                        control = sel.getSelectedElement();
     489
     490                                                                        if ( control )
     491                                                                        {
     492                                                                                // Make undo snapshot.
     493                                                                                editor.fire( 'saveSnapshot' );
     494
     495                                                                                // Delete any element that 'hasLayout' (e.g. hr,table) in IE8 will
     496                                                                                // break up the selection, safely manage it here. (#4795)
     497                                                                                var bookmark = sel.getRanges()[ 0 ].createBookmark();
     498                                                                                // Remove the control manually.
     499                                                                                control.remove();
     500                                                                                sel.selectBookmarks( [ bookmark ] );
     501
     502                                                                                editor.fire( 'saveSnapshot' );
     503
     504                                                                                evt.data.preventDefault();
     505                                                                        }
     506                                                                }
    493507                                                        } );
    494508
    495509                                                        // PageUp/PageDown scrolling is broken in document
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy