X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fclipboard%2Fplugin.js;h=51f53e970b08f8c2976d30b292f7020fa48fa5d7;hp=342d70888f6b4105bdf6e612d6b82428c6d5801e;hb=4e90e78dc97789709ee7404359a5517540c27553;hpb=8f6c203fdaa543c3bca40baea6ae4ddcdf1a77f5 diff --git a/_source/plugins/clipboard/plugin.js b/_source/plugins/clipboard/plugin.js index 342d708..51f53e9 100644 --- a/_source/plugins/clipboard/plugin.js +++ b/_source/plugins/clipboard/plugin.js @@ -158,6 +158,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license } }; + function cancel( evt ) { evt.cancel(); } + // Allow to peek clipboard content by redirecting the // pasting content into a temporary bin and grab the content of it. function getClipboardData( evt, mode, callback ) @@ -208,6 +210,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license var bms = sel.createBookmarks(); + this.on( 'selectionChange', cancel, null, null, 0 ); + // Turn off design mode temporarily before give focus to the paste bin. if ( mode == 'text' ) { @@ -234,6 +238,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { mode == 'text' && CKEDITOR.env.gecko && editor.focusGrabber.focus(); pastebin.remove(); + editor.removeListener( 'selectionChange', cancel ); // Grab the HTML contents. // We need to look for a apple style wrapper on webkit it also adds @@ -322,6 +327,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license else if ( data[ 'text' ] ) editor.insertText( data[ 'text' ] ); + setTimeout( function () { editor.fire( 'afterPaste' ); }, 0 ); + }, null, null, 1000 ); editor.on( 'pasteDialog', function( evt ) @@ -388,7 +395,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { // The very last guard to make sure the // paste has successfully happened. - if ( !data ) + if ( !CKEDITOR.tools.trim( data.toLowerCase().replace( /]+data-cke-bookmark[^<]*?<\/span>/g,'' ) ) ) return; var dataTransfer = {};