| | 85 | |
| | 86 | // Event "dragstart" fires only when dragging |
| | 87 | // from inside the own document. |
| | 88 | target.on( 'dragstart', function( evt ) |
| | 89 | { |
| | 90 | innerDrag = 1; |
| | 91 | editor.fire( 'saveSnapshot' ); |
| | 92 | |
| | 93 | // There's always a "dragend" in accompany with "dragstart". |
| | 94 | ( CKEDITOR.env.ie ? target : new CKEDITOR.dom.element( evt.data.$.target ) ). |
| | 95 | on( 'dragend', function( evt ) |
| | 96 | { |
| | 97 | evt.removeListener(); |
| | 98 | innerDrag = 0; |
| | 99 | setTimeout( function () { editor.fire( 'saveSnapshot' ); }, 0 ); |
| | 100 | }); |
| | 101 | }); |
| | 102 | |
| | 103 | CKEDITOR.env.gecko && doc.on( 'dragenter', function(e) |
| | 104 | { |
| | 105 | // Start of drag from outside the document |
| | 106 | if ( doc.$.documentElement == e.data.$.target ) |
| | 107 | editor.fire( 'saveSnapshot' ); |
| | 108 | }); |
| | 109 | |
| | 110 | // Event "drop" only works for IE and FF right now |
| | 111 | // to catch droppers from outside of the document. |
| | 112 | ( CKEDITOR.env.ie ? target : doc ).on( 'drop', function() |
| | 113 | { |
| | 114 | if ( !innerDrag ) |
| | 115 | { |
| | 116 | if ( CKEDITOR.env.ie ) |
| | 117 | { |
| | 118 | var savedRange = editor.getSelection().getNative().createRange(); |
| | 119 | editor.fire( 'saveSnapshot' ); |
| | 120 | savedRange.select(); |
| | 121 | } |
| | 122 | setTimeout( function () { editor.fire( 'saveSnapshot' ); }, 0 ); |
| | 123 | } |
| | 124 | }); |