/*\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
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
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
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
editor.addCommand( 'maximize',\r
{\r
modes : { wysiwyg : 1, source : 1 },\r
+ readOnly : 1,\r
editorFocus : false,\r
exec : function()\r
{\r
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 styles =\r
+ {\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
+ !( 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
mainWindow.$.scrollTo( 0, 0 );\r
\r
// Resize and move to top left.\r
- var viewPaneSize = mainWindow.getViewPaneSize();\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
// 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
\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
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