Ticket #7422: 7422.patch

File 7422.patch, 1.6 KB (added by Alfonso Martínez de Lizarrondo, 14 years ago)

Proposed patch

  • _source/plugins/undo/plugin.js

     
    7878                                                        if ( !event.data.$.ctrlKey && !event.data.$.metaKey )
    7979                                                                undoManager.type( event );
    8080                                                });
     81
     82                                        // Listen for Drag & Drop
     83                                        if ( CKEDITOR.env.ie )
     84                                        {
     85                                                // Start of drag from inside the document
     86                                                editor.document.getBody().on( 'dragstart', function()
     87                                                        {
     88                                                                editor.fire( 'saveSnapshot' );
     89                                                        });
     90                                                // Missing detection for dragging from outside
     91
     92                                                // End of drag
     93                                                editor.document.getBody().on( 'drop', function()
     94                                                        {
     95                                                                setTimeout( function() {
     96                                                                                editor.fire( 'saveSnapshot' );
     97                                                                }, 0);
     98                                                        });
     99                                        }
     100                                        else
     101                                        {
     102                                                // Start of drag from inside the document
     103                                                editor.document.on( 'dragstart', function()
     104                                                        {
     105                                                                editor.fire( 'saveSnapshot' );
     106                                                        });
     107
     108                                                editor.document.on( 'dragenter', function(e)
     109                                                        {
     110                                                                // Start of drag from outside the document
     111                                                                if ( editor.document.$.documentElement == e.data.$.target )
     112                                                                        editor.fire( 'saveSnapshot' );
     113                                                        });
     114
     115                                                // Webkit doesn't fire this event unless ondragover is cancelled, but then the
     116                                                // drag&drop doesn't happe, and that's worse.
     117                                                editor.document.on( 'drop', function(e)
     118                                                        {
     119                                                                editor.fire( 'saveSnapshot' );
     120                                                        });
     121                                        }
    81122                                });
    82123
    83124                        // Always save an undo snapshot - the previous mode might have
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy