X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fpastefromword%2Fplugin.js;h=c9bd2ec65d894ee23c92b6fde512af1003b5ad29;hp=15853b412d29a381bed5e034ab97eb36ddb58193;hb=1056598c95187351dc58f4991d331e2258d038b5;hpb=4e90e78dc97789709ee7404359a5517540c27553 diff --git a/_source/plugins/pastefromword/plugin.js b/_source/plugins/pastefromword/plugin.js index 15853b4..c9bd2ec 100644 --- a/_source/plugins/pastefromword/plugin.js +++ b/_source/plugins/pastefromword/plugin.js @@ -4,6 +4,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license */ (function() { + function forceHtmlMode( evt ) { evt.data.mode = 'html'; } + CKEDITOR.plugins.add( 'pastefromword', { init : function( editor ) @@ -15,6 +17,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license var resetFromWord = function( evt ) { evt && evt.removeListener(); + editor.removeListener( 'beforePaste', forceHtmlMode ); forceFromWord && setTimeout( function() { forceFromWord = 0; }, 0 ); }; @@ -27,8 +30,11 @@ For licensing, see LICENSE.html or http://ckeditor.com/license canUndo : false, exec : function() { + // Ensure the received data format is HTML and apply content filtering. (#6718) forceFromWord = 1; - if ( editor.execCommand( 'paste' ) === false ) + editor.on( 'beforePaste', forceHtmlMode ); + + if ( editor.execCommand( 'paste', 'html' ) === false ) { editor.on( 'dialogShow', function ( evt ) {