2
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
7
* Licensed under the terms of any of the following licenses at your
10
* - GNU General Public License Version 2 or later (the "GPL")
11
* http://www.gnu.org/licenses/gpl.html
13
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
14
* http://www.gnu.org/licenses/lgpl.html
16
* - Mozilla Public License Version 1.1 or later (the "MPL")
17
* http://www.mozilla.org/MPL/MPL-1.1.html
21
* Plugin: automatically resizes the editor until a configurable maximun
22
* height (FCKConfig.AutoGrowMax), based on its contents.
25
var FCKAutoGrow_Min = window.frameElement.offsetHeight ;
27
function FCKAutoGrow_Check()
29
var oInnerDoc = FCK.EditorDocument ;
31
var iFrameHeight, iInnerHeight ;
33
if ( FCKBrowserInfo.IsIE )
35
iFrameHeight = FCK.EditorWindow.frameElement.offsetHeight ;
36
iInnerHeight = oInnerDoc.body.scrollHeight ;
40
iFrameHeight = FCK.EditorWindow.innerHeight ;
41
iInnerHeight = oInnerDoc.body.offsetHeight ;
44
var iDiff = iInnerHeight - iFrameHeight ;
48
var iMainFrameSize = window.frameElement.offsetHeight ;
50
if ( iDiff > 0 && iMainFrameSize < FCKConfig.AutoGrowMax )
52
iMainFrameSize += iDiff ;
53
if ( iMainFrameSize > FCKConfig.AutoGrowMax )
54
iMainFrameSize = FCKConfig.AutoGrowMax ;
56
else if ( iDiff < 0 && iMainFrameSize > FCKAutoGrow_Min )
58
iMainFrameSize += iDiff ;
59
if ( iMainFrameSize < FCKAutoGrow_Min )
60
iMainFrameSize = FCKAutoGrow_Min ;
65
window.frameElement.height = iMainFrameSize ;
69
FCK.AttachToOnSelectionChange( FCKAutoGrow_Check ) ;
71
function FCKAutoGrow_SetListeners()
73
if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG )
76
FCK.EditorWindow.attachEvent( 'onscroll', FCKAutoGrow_Check ) ;
77
FCK.EditorDocument.attachEvent( 'onkeyup', FCKAutoGrow_Check ) ;
80
if ( FCKBrowserInfo.IsIE )
82
// FCKAutoGrow_SetListeners() ;
83
FCK.Events.AttachEvent( 'OnAfterSetHTML', FCKAutoGrow_SetListeners ) ;
86
function FCKAutoGrow_CheckEditorStatus( sender, status )
88
if ( status == FCK_STATUS_COMPLETE )
92
FCK.Events.AttachEvent( 'OnStatusChange', FCKAutoGrow_CheckEditorStatus ) ;
b'\\ No newline at end of file'