Ticket #7422: 7422_2.patch

File 7422_2.patch, 1.5 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/undo/plugin.js

     
    7878                                                        if ( !event.data.$.ctrlKey && !event.data.$.metaKey )
    7979                                                                undoManager.type( event );
    8080                                                });
    81                                 });
     81
     82                                        var innerDrag, savedRange;
     83                                        var target = editor.document.getBody();
     84
     85                                        // Event "dragstart" fires only when dragging
     86                                        // from inside the own document.
     87                                        target.on( 'dragstart', function()
     88                                                {
     89                                                        innerDrag = 1;
     90                                                        editor.fire( 'saveSnapshot' );
     91
     92                                                        // There's always a "dragend" in accompany with "dragstart".
     93                                                        target.on( 'dragend', function( evt )
     94                                                                {
     95                                                                        evt.removeListener();
     96                                                                        innerDrag = 0;
     97                                                                        setTimeout( function () { editor.fire( 'saveSnapshot' ); }, 0 );
     98                                                                });
     99                                                });
    82100
     101                                                // Event "drop" only works for IE and FF right now
     102                                                // to catch droppers from outside of the document.
     103                                                target.on( 'drop', function()
     104                                                {
     105                                                        if ( !innerDrag )
     106                                                        {
     107                                                                CKEDITOR.env.ie && ( savedRange = editor.getSelection().getNative().createRange() );
     108                                                                editor.fire( 'saveSnapshot' );
     109                                                                savedRange.select();
     110                                                                setTimeout( function () { editor.fire( 'saveSnapshot' ); }, 0 );
     111                                                        }
     112                                                });
     113                                });
     114
    83115                        // Always save an undo snapshot - the previous mode might have
    84116                        // changed editor contents.
    85117                        editor.on( 'beforeModeUnload', function()
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy