JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.2
[ckeditor.git] / _source / plugins / maximize / plugin.js
index fa2f791..97ac0b0 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
@@ -85,7 +85,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                for ( var i in all )\r
                {\r
                        var one = all[ i ];\r
-                       if ( one.mode == 'wysiwyg' )\r
+                       if ( one.mode == 'wysiwyg' && !one.readOnly )\r
                        {\r
                                var body = one.document.getBody();\r
                                // Refresh 'contentEditable' otherwise\r
@@ -154,7 +154,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 \r
                        editor.addCommand( 'maximize',\r
                                {\r
-                                       modes : { wysiwyg : 1, source : 1 },\r
+                                       // Disabled on iOS (#8307).\r
+                                       modes : { wysiwyg : !CKEDITOR.env.iOS, source : !CKEDITOR.env.iOS },\r
+                                       readOnly : 1,\r
                                        editorFocus : false,\r
                                        exec : function()\r
                                        {\r
@@ -194,17 +196,16 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                        container.setCustomData( 'maximize_saved_styles', saveStyles( container, true ) );\r
 \r
                                                        // Hide scroll bars.\r
-                                                       var viewPaneSize = mainWindow.getViewPaneSize();\r
                                                        var styles =\r
                                                                {\r
-                                                                       overflow : 'hidden',\r
+                                                                       overflow : CKEDITOR.env.webkit ? '' : 'hidden',         // #6896\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
+                                                       !( CKEDITOR.env.gecko && CKEDITOR.env.quirks ) && mainDocument.getBody().setStyles( styles );\r
 \r
                                                        // Scroll to the top left (IE needs some time for it - #4923).\r
                                                        CKEDITOR.env.ie ?\r
@@ -212,7 +213,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                mainWindow.$.scrollTo( 0, 0 );\r
 \r
                                                        // Resize and move to top left.\r
-                                                       container.setStyle( 'position', 'absolute' );\r
+                                                       // Special treatment for FF Quirks (#7284)\r
+                                                       container.setStyle( 'position', CKEDITOR.env.gecko && CKEDITOR.env.quirks ? 'fixed' : 'absolute' );\r
                                                        container.$.offsetLeft;                 // SAFARI BUG: See #2066.\r
                                                        container.setStyles(\r
                                                                {\r
@@ -268,6 +270,13 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                        // Remove cke_maximized class.\r
                                                        container.removeClass( 'cke_maximized' );\r
 \r
+                                                       // Webkit requires a re-layout on editor chrome. (#6695)\r
+                                                       if ( CKEDITOR.env.webkit )\r
+                                                       {\r
+                                                               container.setStyle( 'display', 'inline' );\r
+                                                               setTimeout( function(){ container.setStyle( 'display', 'block' ); }, 0 );\r
+                                                       }\r
+\r
                                                        if ( shim )\r
                                                        {\r
                                                                shim.remove();\r
@@ -283,12 +292,16 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 \r
                                                // Toggle button label.\r
                                                var button = this.uiItems[ 0 ];\r
-                                               var label = ( this.state == CKEDITOR.TRISTATE_OFF )\r
-                                                       ? lang.maximize : lang.minimize;\r
-                                               var buttonNode = editor.element.getDocument().getById( button._.id );\r
-                                               buttonNode.getChild( 1 ).setHtml( label );\r
-                                               buttonNode.setAttribute( 'title', label );\r
-                                               buttonNode.setAttribute( 'href', 'javascript:void("' + label + '");' );\r
+                                               // Only try to change the button if it exists (#6166)\r
+                                               if( button )\r
+                                               {\r
+                                                       var label = ( this.state == CKEDITOR.TRISTATE_OFF )\r
+                                                               ? lang.maximize : lang.minimize;\r
+                                                       var buttonNode = editor.element.getDocument().getById( button._.id );\r
+                                                       buttonNode.getChild( 1 ).setHtml( label );\r
+                                                       buttonNode.setAttribute( 'title', label );\r
+                                                       buttonNode.setAttribute( 'href', 'javascript:void("' + label + '");' );\r
+                                               }\r
 \r
                                                // Restore selection and scroll position in editing area.\r
                                                if ( editor.mode == 'wysiwyg' )\r