JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.1
[ckeditor.git] / _source / plugins / wysiwygarea / plugin.js
index d837ea7..6e4eacb 100644 (file)
@@ -51,6 +51,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                if ( this.dataProcessor )\r
                        data = this.dataProcessor.toHtml( data );\r
 \r
+               if ( !data )\r
+                       return;\r
+\r
                // HTML insertion only considers the first range.\r
                var selection = this.getSelection(),\r
                        range = selection.getRanges()[ 0 ];\r
@@ -58,6 +61,26 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                if ( range.checkReadOnly() )\r
                        return;\r
 \r
+               // Opera: force block splitting when pasted content contains block. (#7801)\r
+               if ( CKEDITOR.env.opera )\r
+               {\r
+                       var path = new CKEDITOR.dom.elementPath( range.startContainer );\r
+                       if ( path.block )\r
+                       {\r
+                               var nodes = CKEDITOR.htmlParser.fragment.fromHtml( data, false ).children;\r
+                               for ( var i = 0, count = nodes.length; i < count; i++ )\r
+                               {\r
+                                       if ( nodes[ i ]._.isBlockLike )\r
+                                       {\r
+                                               range.splitBlock( this.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p' );\r
+                                               range.insertNode( range.document.createText( '' ) );\r
+                                               range.select();\r
+                                               break;\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+\r
                if ( CKEDITOR.env.ie )\r
                {\r
                        var selIsLocked = selection.isLocked;\r
@@ -536,30 +559,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                if ( document.location.protocol == 'chrome:' )\r
                                                        CKEDITOR.event.useCapture = false;\r
 \r
-                                               // The container must be visible when creating the iframe in FF (#5956)\r
-                                               var element = editor.element,\r
-                                                       isHidden = CKEDITOR.env.gecko && !element.isVisible(),\r
-                                                       previousStyles = {};\r
-                                               if ( isHidden )\r
-                                               {\r
-                                                       element.show();\r
-                                                       previousStyles = {\r
-                                                               position : element.getStyle( 'position' ),\r
-                                                               top : element.getStyle( 'top' )\r
-                                                       };\r
-                                                       element.setStyles( { position : 'absolute', top : '-3000px' } );\r
-                                               }\r
-\r
                                                mainElement.append( iframe );\r
-\r
-                                               if ( isHidden )\r
-                                               {\r
-                                                       setTimeout( function()\r
-                                                       {\r
-                                                               element.hide();\r
-                                                               element.setStyles( previousStyles );\r
-                                                       }, 1000 );\r
-                                               }\r
                                        };\r
 \r
                                        // The script that launches the bootstrap logic on 'domReady', so the document\r