Subversion Repositories Applications.papyrus

Rev

Rev 1688 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1688 Rev 1921
Line 1... Line 1...
1
/*
1
/*
2
 * FCKeditor - The text editor for internet
2
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
 * Copyright (C) 2003-2006 Frederico Caldeira Knabben
3
 * Copyright (C) 2003-2008 Frederico Caldeira Knabben
-
 
4
 *
-
 
5
 * == BEGIN LICENSE ==
4
 * 
6
 *
5
 * Licensed under the terms of the GNU Lesser General Public License:
7
 * Licensed under the terms of any of the following licenses at your
-
 
8
 * choice:
-
 
9
 *
-
 
10
 *  - GNU General Public License Version 2 or later (the "GPL")
6
 * 		http://www.opensource.org/licenses/lgpl-license.php
11
 *    http://www.gnu.org/licenses/gpl.html
7
 * 
12
 *
8
 * For further information visit:
13
 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
9
 * 		http://www.fckeditor.net/
14
 *    http://www.gnu.org/licenses/lgpl.html
10
 * 
15
 *
11
 * "Support Open Source software. What about a donation today?"
16
 *  - Mozilla Public License Version 1.1 or later (the "MPL")
-
 
17
 *    http://www.mozilla.org/MPL/MPL-1.1.html
12
 * 
18
 *
13
 * File Name: fckplugin.js
19
 * == END LICENSE ==
-
 
20
 *
14
 * 	Plugin: automatically resizes the editor until a configurable maximun 
21
 * Plugin: automatically resizes the editor until a configurable maximun
15
 * 	height (FCKConfig.AutoGrowMax), based on its contents.
22
 * height (FCKConfig.AutoGrowMax), based on its contents.
16
 * 
-
 
17
 * File Authors:
-
 
18
 * 		Frederico Caldeira Knabben (fredck@fckeditor.net)
-
 
19
 */
23
 */
Line 20... Line 24...
20
 
24
 
Line 21... Line 25...
21
var FCKAutoGrow_Min = window.frameElement.offsetHeight ;
25
var FCKAutoGrow_Min = window.frameElement.offsetHeight ;
22
 
26
 
23
function FCKAutoGrow_Check()
27
function FCKAutoGrow_Check()
Line 24... Line 28...
24
{
28
{
25
	var oInnerDoc = FCK.EditorDocument ;
29
	var oInnerDoc = FCK.EditorDocument ;
26
 
30
 
27
	var iFrameHeight, iInnerHeight ;
31
	var iFrameHeight, iInnerHeight ;
28
	
32
 
29
	if ( FCKBrowserInfo.IsIE )
33
	if ( FCKBrowserInfo.IsIE )
30
	{
34
	{
Line 40... Line 44...
40
	var iDiff = iInnerHeight - iFrameHeight ;
44
	var iDiff = iInnerHeight - iFrameHeight ;
Line 41... Line 45...
41
 
45
 
42
	if ( iDiff != 0 )
46
	if ( iDiff != 0 )
43
	{
47
	{
44
		var iMainFrameSize = window.frameElement.offsetHeight ;
48
		var iMainFrameSize = window.frameElement.offsetHeight ;
45
		
49
 
46
		if ( iDiff > 0 && iMainFrameSize < FCKConfig.AutoGrowMax )
50
		if ( iDiff > 0 && iMainFrameSize < FCKConfig.AutoGrowMax )
47
		{
51
		{
48
			iMainFrameSize += iDiff ;
52
			iMainFrameSize += iDiff ;
49
			if ( iMainFrameSize > FCKConfig.AutoGrowMax )
53
			if ( iMainFrameSize > FCKConfig.AutoGrowMax )
Line 55... Line 59...
55
			if ( iMainFrameSize < FCKAutoGrow_Min )
59
			if ( iMainFrameSize < FCKAutoGrow_Min )
56
				iMainFrameSize = FCKAutoGrow_Min ;
60
				iMainFrameSize = FCKAutoGrow_Min ;
57
		}
61
		}
58
		else
62
		else
59
			return ;
63
			return ;
60
			
64
 
61
		window.frameElement.height = iMainFrameSize ;
65
		window.frameElement.height = iMainFrameSize ;
-
 
66
 
-
 
67
		// Gecko browsers use an onresize handler to update the innermost
-
 
68
		// IFRAME's height. If the document is modified before the onresize
-
 
69
		// is triggered, the plugin will miscalculate the new height. Thus,
-
 
70
		// forcibly trigger onresize. #1336
-
 
71
		if ( typeof window.onresize == 'function' )
-
 
72
			window.onresize() ;
62
	}
73
	}
63
}
74
}
Line 64... Line 75...
64
 
75
 
Line 65... Line 76...
65
FCK.AttachToOnSelectionChange( FCKAutoGrow_Check ) ;
76
FCK.AttachToOnSelectionChange( FCKAutoGrow_Check ) ;
66
 
77
 
-
 
78
function FCKAutoGrow_SetListeners()
-
 
79
{
-
 
80
	if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG )
67
function FCKAutoGrow_SetListeners()
81
		return ;
68
{
82
 
69
	FCK.EditorWindow.attachEvent( 'onscroll', FCKAutoGrow_Check ) ;
83
	FCK.EditorWindow.attachEvent( 'onscroll', FCKAutoGrow_Check ) ;
Line 70... Line 84...
70
	FCK.EditorDocument.attachEvent( 'onkeyup', FCKAutoGrow_Check ) ;
84
	FCK.EditorDocument.attachEvent( 'onkeyup', FCKAutoGrow_Check ) ;
Line 80... Line 94...
80
{
94
{
81
	if ( status == FCK_STATUS_COMPLETE )
95
	if ( status == FCK_STATUS_COMPLETE )
82
		FCKAutoGrow_Check() ;
96
		FCKAutoGrow_Check() ;
83
}
97
}
Line 84... Line -...
84
 
-
 
85
FCK.Events.AttachEvent( 'OnStatusChange', FCKAutoGrow_CheckEditorStatus ) ;
98
 
-
 
99
FCK.Events.AttachEvent( 'OnStatusChange', FCKAutoGrow_CheckEditorStatus ) ;