X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fpastefromword%2Fplugin.js;h=5686c303e7ea9d840196b4d0a26060f1ce68876a;hb=fb481ba0a7d298e3e7b9034fcb9f2afdc6e8e796;hp=15853b412d29a381bed5e034ab97eb36ddb58193;hpb=4e90e78dc97789709ee7404359a5517540c27553;p=ckeditor.git diff --git a/_source/plugins/pastefromword/plugin.js b/_source/plugins/pastefromword/plugin.js index 15853b4..5686c30 100644 --- a/_source/plugins/pastefromword/plugin.js +++ b/_source/plugins/pastefromword/plugin.js @@ -1,9 +1,11 @@ /* -Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. 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 ) {