JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.4.3
[ckeditor.git] / _source / plugins / maximize / plugin.js
index 9f18043..fa2f791 100644 (file)
@@ -10,8 +10,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                if ( !formElement || formElement.type != CKEDITOR.NODE_ELEMENT || formElement.getName() != 'form' )\r
                        return [];\r
 \r
-               var hijackRecord = [];\r
-               var hijackNames = [ 'style', 'className' ];\r
+               var hijackRecord = [],\r
+                       hijackNames = [ 'style', 'className' ];\r
                for ( var i = 0 ; i < hijackNames.length ; i++ )\r
                {\r
                        var name = hijackNames[i];\r
@@ -129,12 +129,12 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                init : function( editor )\r
                {\r
                        var lang = editor.lang;\r
-                       var mainDocument = CKEDITOR.document;\r
-                       var mainWindow = mainDocument.getWindow();\r
+                       var mainDocument = CKEDITOR.document,\r
+                               mainWindow = mainDocument.getWindow();\r
 \r
                        // Saved selection and scroll position for the editing area.\r
-                       var savedSelection;\r
-                       var savedScroll;\r
+                       var savedSelection,\r
+                               savedScroll;\r
 \r
                        // Saved scroll position for the outer window.\r
                        var outerScroll;\r
@@ -194,20 +194,17 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                        container.setCustomData( 'maximize_saved_styles', saveStyles( container, true ) );\r
 \r
                                                        // Hide scroll bars.\r
-                                                       if ( CKEDITOR.env.ie )\r
-                                                       {\r
-                                                               mainDocument.$.documentElement.style.overflow =\r
-                                                                       mainDocument.getBody().$.style.overflow = 'hidden';\r
-                                                       }\r
-                                                       else\r
-                                                       {\r
-                                                               mainDocument.getBody().setStyles(\r
-                                                                       {\r
-                                                                               overflow : 'hidden',\r
-                                                                               width : '0px',\r
-                                                                               height : '0px'\r
-                                                                       } );\r
-                                                       }\r
+                                                       var viewPaneSize = mainWindow.getViewPaneSize();\r
+                                                       var styles =\r
+                                                               {\r
+                                                                       overflow : 'hidden',\r
+                                                                       width : 0,\r
+                                                                       height : 0\r
+                                                               };\r
+\r
+                                                       mainDocument.getDocumentElement().setStyles( styles );\r
+                                                       !CKEDITOR.env.gecko && mainDocument.getDocumentElement().setStyle( 'position', 'fixed' );\r
+                                                       mainDocument.getBody().setStyles( styles );\r
 \r
                                                        // Scroll to the top left (IE needs some time for it - #4923).\r
                                                        CKEDITOR.env.ie ?\r
@@ -215,7 +212,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                mainWindow.$.scrollTo( 0, 0 );\r
 \r
                                                        // Resize and move to top left.\r
-                                                       var viewPaneSize = mainWindow.getViewPaneSize();\r
                                                        container.setStyle( 'position', 'absolute' );\r
                                                        container.$.offsetLeft;                 // SAFARI BUG: See #2066.\r
                                                        container.setStyles(\r
@@ -333,10 +329,11 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                        command : 'maximize'\r
                                } );\r
 \r
-                       // Restore the command state after mode change.\r
+                       // Restore the command state after mode change, unless it has been changed to disabled (#6467)\r
                        editor.on( 'mode', function()\r
                                {\r
-                                       editor.getCommand( 'maximize' ).setState( savedState );\r
+                                       var command = editor.getCommand( 'maximize' );\r
+                                       command.setState( command.state == CKEDITOR.TRISTATE_DISABLED ? CKEDITOR.TRISTATE_DISABLED : savedState );\r
                                }, null, null, 100 );\r
                }\r
        } );\r