X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fpastefromword%2Fplugin.js;h=cc1add45cd3ec874d349ae00ef41df7a0619d6ca;hb=a272c66d841421f8bf933c16535bdcde1c4649fc;hp=15853b412d29a381bed5e034ab97eb36ddb58193;hpb=4e90e78dc97789709ee7404359a5517540c27553;p=ckeditor.git diff --git a/_source/plugins/pastefromword/plugin.js b/_source/plugins/pastefromword/plugin.js index 15853b4..cc1add4 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-2013, 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 ) {