X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fpastefromword%2Fplugin.js;h=15853b412d29a381bed5e034ab97eb36ddb58193;hp=a5a90d51074e1e386a44db3ae7a5d0b259cb3d9d;hb=4e90e78dc97789709ee7404359a5517540c27553;hpb=8f6c203fdaa543c3bca40baea6ae4ddcdf1a77f5 diff --git a/_source/plugins/pastefromword/plugin.js b/_source/plugins/pastefromword/plugin.js index a5a90d5..15853b4 100644 --- a/_source/plugins/pastefromword/plugin.js +++ b/_source/plugins/pastefromword/plugin.js @@ -12,9 +12,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Flag indicate this command is actually been asked instead of a generic // pasting. var forceFromWord = 0; - var resetFromWord = function() + var resetFromWord = function( evt ) { - setTimeout( function() { forceFromWord = 0; }, 0 ); + evt && evt.removeListener(); + forceFromWord && setTimeout( function() { forceFromWord = 0; }, 0 ); }; // Features bring by this command beside the normal process: @@ -29,14 +30,19 @@ For licensing, see LICENSE.html or http://ckeditor.com/license forceFromWord = 1; if ( editor.execCommand( 'paste' ) === false ) { - editor.on( 'dialogHide', function ( evt ) - { - evt.removeListener(); - resetFromWord(); - }); + editor.on( 'dialogShow', function ( evt ) + { + evt.removeListener(); + evt.data.on( 'cancel', resetFromWord ); + }); + + editor.on( 'dialogHide', function( evt ) + { + evt.data.removeListener( 'cancel', resetFromWord ); + } ); } - else - resetFromWord(); + + editor.on( 'afterPaste', resetFromWord ); } });