X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fmaximize%2Fplugin.js;h=4c4054471b7b54452d3bbc6edad2b6f00e886036;hp=2b7ffe3cf152f9bc7281032bce80907233afdc22;hb=8761695d9b70afe75905deaac88f78c1f8aeb32d;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91 diff --git a/_source/plugins/maximize/plugin.js b/_source/plugins/maximize/plugin.js index 2b7ffe3..4c40544 100644 --- a/_source/plugins/maximize/plugin.js +++ b/_source/plugins/maximize/plugin.js @@ -111,7 +111,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license editor.addCommand( 'maximize', { modes : { wysiwyg : 1, source : 1 }, - + editorFocus : false, exec : function() { var container = editor.container.getChild( [ 0, 0 ] ); @@ -120,7 +120,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Save current selection and scroll position in editing area. if ( editor.mode == 'wysiwyg' ) { - savedSelection = editor.getSelection().getRanges(); + var selection = editor.getSelection(); + savedSelection = selection && selection.getRanges(); savedScroll = mainWindow.getScrollPosition(); } else @@ -223,14 +224,25 @@ For licensing, see LICENSE.html or http://ckeditor.com/license this.toggleState(); + // Toggle button label. + var button = this.uiItems[ 0 ]; + var label = ( this.state == CKEDITOR.TRISTATE_OFF ) + ? lang.maximize : lang.minimize; + var buttonNode = editor.element.getDocument().getById( button._.id ); + buttonNode.getChild( 1 ).setHtml( label ); + buttonNode.setAttribute( 'title', label ); + buttonNode.setAttribute( 'href', 'javascript:void("' + label + '");' ); + // Restore selection and scroll position in editing area. if ( editor.mode == 'wysiwyg' ) { - editor.getSelection().selectRanges( savedSelection ); + if ( savedSelection ) + { + editor.getSelection().selectRanges(savedSelection); + var element = editor.getSelection().getStartElement(); + element && element.scrollIntoView( true ); + } - var element = editor.getSelection().getStartElement(); - if ( element ) - element.scrollIntoView( true ); else mainWindow.$.scrollTo( savedScroll.x, savedScroll.y ); }