JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.5.4
[ckeditor.git] / _source / plugins / clipboard / plugin.js
index 51f53e9..ebfb1f8 100644 (file)
@@ -214,17 +214,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 \r
                // Turn off design mode temporarily before give focus to the paste bin.\r
                if ( mode == 'text' )\r
-               {\r
-                       if ( CKEDITOR.env.ie )\r
-                       {\r
-                               var ieRange = doc.getBody().$.createTextRange();\r
-                               ieRange.moveToElementText( pastebin.$ );\r
-                               ieRange.execCommand( 'Paste' );\r
-                               evt.data.preventDefault();\r
-                       }\r
-                       else\r
-                               pastebin.$.focus();\r
-               }\r
+                       pastebin.$.focus();\r
                else\r
                {\r
                        range.setStartAt( pastebin, CKEDITOR.POSITION_AFTER_START );\r
@@ -377,29 +367,31 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 \r
                                editor.on( 'key', onKey, editor );\r
 \r
-                               var mode = editor.config.forcePasteAsPlainText ? 'text' : 'html';\r
-\r
                                // We'll be catching all pasted content in one line, regardless of whether the\r
                                // it's introduced by a document command execution (e.g. toolbar buttons) or\r
                                // user paste behaviors. (e.g. Ctrl-V)\r
                                editor.on( 'contentDom', function()\r
                                {\r
                                        var body = editor.document.getBody();\r
-                                       body.on( ( ( mode == 'text' && CKEDITOR.env.ie ) || CKEDITOR.env.webkit ) ? 'paste' : 'beforepaste',\r
-                                               function( evt )\r
+                                       body.on( CKEDITOR.env.webkit ? 'paste' : 'beforepaste', function( evt )\r
                                                {\r
                                                        if ( depressBeforeEvent )\r
                                                                return;\r
 \r
-                                                       getClipboardData.call( editor, evt, mode, function ( data )\r
+                                                       // Fire 'beforePaste' event so clipboard flavor get customized\r
+                                                       // by other plugins.\r
+                                                       var eventData =  { mode : 'html' };\r
+                                                       editor.fire( 'beforePaste', eventData );\r
+\r
+                                                       getClipboardData.call( editor, evt, eventData.mode, function ( data )\r
                                                        {\r
                                                                // The very last guard to make sure the\r
                                                                // paste has successfully happened.\r
-                                                               if ( !CKEDITOR.tools.trim( data.toLowerCase().replace( /<span[^>]+data-cke-bookmark[^<]*?<\/span>/g,'' ) ) )\r
+                                                               if ( !( data = CKEDITOR.tools.trim( data.replace( /<span[^>]+data-cke-bookmark[^<]*?<\/span>/ig,'' ) ) ) )\r
                                                                        return;\r
 \r
                                                                var dataTransfer = {};\r
-                                                               dataTransfer[ mode ] = data;\r
+                                                               dataTransfer[ eventData.mode ] = data;\r
                                                                editor.fire( 'paste', dataTransfer );\r
                                                        } );\r
                                                });\r