JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.1.1
[ckeditor.git] / _source / plugins / sourcearea / plugin.js
index ca2d307..a7331b6 100644 (file)
@@ -14,7 +14,8 @@ CKEDITOR.plugins.add( 'sourcearea',
 \r
        init : function( editor )\r
        {\r
-               var sourcearea = CKEDITOR.plugins.sourcearea;\r
+               var sourcearea = CKEDITOR.plugins.sourcearea,\r
+                       win = CKEDITOR.document.getWindow();\r
 \r
                editor.on( 'editingBlockReady', function()\r
                        {\r
@@ -48,29 +49,26 @@ CKEDITOR.plugins.add( 'sourcearea',
                                                                'text-align' : 'left'\r
                                                        };\r
 \r
-                                                       // The textarea height/width='100%' doesn't\r
-                                                       // constraint to the 'td' in IE strick mode\r
+                                                       // Having to make <textarea> fixed sized to conque the following bugs:\r
+                                                       // 1. The textarea height/width='100%' doesn't constraint to the 'td' in IE6/7.\r
+                                                       // 2. Unexpected vertical-scrolling behavior happens whenever focus is moving out of editor\r
+                                                       // if text content within it has overflowed. (#4762)\r
                                                        if ( CKEDITOR.env.ie )\r
                                                        {\r
-                                                               if ( !CKEDITOR.env.ie8Compat )\r
+                                                               onResize = function()\r
                                                                {\r
-                                                                       onResize = function()\r
-                                                                               {\r
-                                                                                       // Holder rectange size is stretched by textarea,\r
-                                                                                       // so hide it just for a moment.\r
-                                                                                       textarea.hide();\r
-                                                                                       textarea.setStyle( 'height', holderElement.$.clientHeight + 'px' );\r
-                                                                                       // When we have proper holder size, show textarea again.\r
-                                                                                       textarea.show();\r
-                                                                               };\r
-                                                                       editor.on( 'resize', onResize );\r
-                                                                       editor.on( 'afterCommandExec', function( event )\r
-                                                                       {\r
-                                                                               if ( event.data.name == 'toolbarCollapse' )\r
-                                                                                       onResize();\r
-                                                                       });\r
-                                                                       styles.height = holderElement.$.clientHeight + 'px';\r
-                                                               }\r
+                                                                       // Holder rectange size is stretched by textarea,\r
+                                                                       // so hide it just for a moment.\r
+                                                                       textarea.hide();\r
+                                                                       textarea.setStyle( 'height', holderElement.$.clientHeight + 'px' );\r
+                                                                       textarea.setStyle( 'width', holderElement.$.clientWidth + 'px' );\r
+                                                                       // When we have proper holder size, show textarea again.\r
+                                                                       textarea.show();\r
+                                                               };\r
+\r
+                                                               editor.on( 'resize', onResize );\r
+                                                               win.on( 'resize', onResize );\r
+                                                               setTimeout( onResize, 0 );\r
                                                        }\r
                                                        else\r
                                                        {\r
@@ -139,7 +137,10 @@ CKEDITOR.plugins.add( 'sourcearea',
                                                        editor.textarea = textarea = null;\r
 \r
                                                        if ( onResize )\r
+                                                       {\r
                                                                editor.removeListener( 'resize', onResize );\r
+                                                               win.removeListener( 'resize', onResize );\r
+                                                       }\r
 \r
                                                        if ( CKEDITOR.env.ie && CKEDITOR.env.version < 8 )\r
                                                                holderElement.removeStyle( 'position' );\r