/*\r
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
For licensing, see LICENSE.html or http://ckeditor.com/license\r
*/\r
\r
editor.addCommand( 'maximize',\r
{\r
modes : { wysiwyg : 1, source : 1 },\r
-\r
+ editorFocus : false,\r
exec : function()\r
{\r
- var container = editor.container.getChild( [ 0, 0 ] );\r
+ var container = editor.container.getChild( 0 );\r
var contents = editor.getThemeSpace( 'contents' );\r
\r
// Save current selection and scroll position in editing area.\r
if ( editor.mode == 'wysiwyg' )\r
{\r
- savedSelection = editor.getSelection().getRanges();\r
+ var selection = editor.getSelection();\r
+ savedSelection = selection && selection.getRanges();\r
savedScroll = mainWindow.getScrollPosition();\r
}\r
else\r
} );\r
}\r
\r
- // Scroll to the top left.\r
- mainWindow.$.scrollTo( 0, 0 );\r
+ // Scroll to the top left (IE needs some time for it - #4923).\r
+ CKEDITOR.env.ie ?\r
+ setTimeout( function() { mainWindow.$.scrollTo( 0, 0 ); }, 0 ) :\r
+ mainWindow.$.scrollTo( 0, 0 );\r
\r
// Resize and move to top left.\r
var viewPaneSize = mainWindow.getViewPaneSize();\r
}\r
\r
// Restore the window scroll position.\r
- mainWindow.$.scrollTo( outerScroll.x, outerScroll.y );\r
+ CKEDITOR.env.ie ?\r
+ setTimeout( function() { mainWindow.$.scrollTo( outerScroll.x, outerScroll.y ); }, 0 ) :\r
+ mainWindow.$.scrollTo( outerScroll.x, outerScroll.y );\r
\r
// Remove cke_maximized class.\r
container.removeClass( 'cke_maximized' );\r
\r
this.toggleState();\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
+\r
// Restore selection and scroll position in editing area.\r
if ( editor.mode == 'wysiwyg' )\r
{\r
- editor.getSelection().selectRanges( savedSelection );\r
+ if ( savedSelection )\r
+ {\r
+ editor.getSelection().selectRanges(savedSelection);\r
+ var element = editor.getSelection().getStartElement();\r
+ element && element.scrollIntoView( true );\r
+ }\r
\r
- var element = editor.getSelection().getStartElement();\r
- if ( element )\r
- element.scrollIntoView( true );\r
else\r
mainWindow.$.scrollTo( savedScroll.x, savedScroll.y );\r
}\r