JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.5.3
[ckeditor.git] / _source / plugins / clipboard / plugin.js
index 342d708..51f53e9 100644 (file)
@@ -158,6 +158,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                }\r
        };\r
 \r
+       function cancel( evt ) { evt.cancel(); }\r
+\r
        // Allow to peek clipboard content by redirecting the\r
        // pasting content into a temporary bin and grab the content of it.\r
        function getClipboardData( evt, mode, callback )\r
@@ -208,6 +210,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 \r
                var bms = sel.createBookmarks();\r
 \r
+               this.on( 'selectionChange', cancel, null, null, 0 );\r
+\r
                // Turn off design mode temporarily before give focus to the paste bin.\r
                if ( mode == 'text' )\r
                {\r
@@ -234,6 +238,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                {\r
                        mode == 'text' && CKEDITOR.env.gecko && editor.focusGrabber.focus();\r
                        pastebin.remove();\r
+                       editor.removeListener( 'selectionChange', cancel );\r
 \r
                        // Grab the HTML contents.\r
                        // We need to look for a apple style wrapper on webkit it also adds\r
@@ -322,6 +327,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                else if ( data[ 'text' ] )\r
                                                        editor.insertText( data[ 'text' ] );\r
 \r
+                                               setTimeout( function () { editor.fire( 'afterPaste' ); }, 0 );\r
+\r
                                        }, null, null, 1000 );\r
 \r
                                editor.on( 'pasteDialog', function( evt )\r
@@ -388,7 +395,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                        {\r
                                                                // The very last guard to make sure the\r
                                                                // paste has successfully happened.\r
-                                                               if ( !data )\r
+                                                               if ( !CKEDITOR.tools.trim( data.toLowerCase().replace( /<span[^>]+data-cke-bookmark[^<]*?<\/span>/g,'' ) ) )\r
                                                                        return;\r
 \r
                                                                var dataTransfer = {};\r