JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.5.4
[ckeditor.git] / _source / plugins / pastefromword / plugin.js
index 15853b4..c9bd2ec 100644 (file)
@@ -4,6 +4,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 */\r
 (function()\r
 {\r
+       function forceHtmlMode( evt ) { evt.data.mode = 'html'; }\r
+\r
        CKEDITOR.plugins.add( 'pastefromword',\r
        {\r
                init : function( editor )\r
@@ -15,6 +17,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                        var resetFromWord = function( evt )\r
                                {\r
                                        evt && evt.removeListener();\r
+                                       editor.removeListener( 'beforePaste', forceHtmlMode );\r
                                        forceFromWord && setTimeout( function() { forceFromWord = 0; }, 0 );\r
                                };\r
 \r
@@ -27,8 +30,11 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                canUndo : false,\r
                                exec : function()\r
                                {\r
+                                       // Ensure the received data format is HTML and apply content filtering. (#6718)\r
                                        forceFromWord = 1;\r
-                                       if ( editor.execCommand( 'paste' ) === false )\r
+                                       editor.on( 'beforePaste', forceHtmlMode );\r
+\r
+                                       if ( editor.execCommand( 'paste', 'html' ) === false )\r
                                        {\r
                                                editor.on( 'dialogShow', function ( evt )\r
                                                {\r