JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.5
[ckeditor.git] / _source / plugins / autogrow / plugin.js
index fdbb578..6ffef63 100644 (file)
@@ -24,18 +24,23 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                return height;\r
        }\r
 \r
+       function getScrollable( editor )\r
+       {\r
+               var doc = editor.document,\r
+                       body = doc.getBody(),\r
+                       htmlElement = doc.getDocumentElement();\r
+\r
+               // Quirks mode overflows body, standards overflows document element\r
+               return doc.$.compatMode == 'BackCompat' ? body : htmlElement;\r
+       }\r
+\r
        var resizeEditor = function( editor )\r
        {\r
                if ( !editor.window )\r
                        return;\r
 \r
-               var doc = editor.document,\r
-                       iframe = new CKEDITOR.dom.element( doc.getWindow().$.frameElement ),\r
-                       body = doc.getBody(),\r
-                       htmlElement = doc.getDocumentElement(),\r
+               var scrollable = getScrollable( editor ),\r
                        currentHeight = editor.window.getViewPaneSize().height,\r
-                       // Quirks mode overflows body, standards overflows document element\r
-                       scrollable = doc.$.compatMode == 'BackCompat' ? body : htmlElement,\r
                        newHeight = contentHeight( scrollable );\r
 \r
                // Additional space specified by user.\r
@@ -89,6 +94,21 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                        }\r
                                });\r
                        }\r
+\r
+                       // Coordinate with the "maximize" plugin. (#9311)\r
+                       editor.on( 'beforeCommandExec', function( evt )\r
+                       {\r
+                               if ( evt.data.name == 'maximize' && evt.editor.mode == 'wysiwyg' )\r
+                               {\r
+                                       if ( evt.data.command.state == CKEDITOR.TRISTATE_OFF )\r
+                                       {\r
+                                               var scrollable = getScrollable( editor );\r
+                                               scrollable.removeStyle( 'overflow' );\r
+                                       }\r
+                                       else\r
+                                               resizeEditor( editor );\r
+                               }\r
+                       });\r
                }\r
        });\r
 })();\r