18 | | // We can not use documentElement to calculate the height for IE (#6061). |
19 | | // It is not good for IE Quirks, yet using offsetHeight would also not work as expected (#6408). |
20 | | // We do the same for FF because of the html height workaround (#6341). |
21 | | if ( CKEDITOR.env.ie || CKEDITOR.env.gecko ) |
22 | | newHeight = doc.getBody().$.scrollHeight + ( CKEDITOR.env.ie && CKEDITOR.env.quirks ? 0 : 24 ); |
23 | | else |
24 | | newHeight = doc.getDocumentElement().$.offsetHeight; |
| 22 | var delta = |
| 23 | // Delta height when in standards; |
| 24 | htmlElement.scrollHeight - ( htmlElement.clientHeight || htmlElement.offsetHeight ) |
| 25 | // Delta height when in quirks; |
| 26 | || body.scrollHeight - body.clientHeight |
| 27 | // Negative scrollHeight is not supported in some browsers, |
| 28 | // figure it out by counting spaces after <body>, magic number |
| 29 | // "28" is a preserved amount of spaces out of body. |
| 30 | || ( CKEDITOR.env.ie && !CKEDITOR.env.quirks || CKEDITOR.env.gecko ? |
| 31 | body.offsetHeight - htmlElement.clientHeight + 28 : 0 ); |
26 | | var min = editor.config.autoGrow_minHeight, |
27 | | max = editor.config.autoGrow_maxHeight; |
28 | | ( min == undefined ) && ( editor.config.autoGrow_minHeight = min = 200 ); |
29 | | if ( min ) |
30 | | newHeight = Math.max( newHeight, min ); |
31 | | if ( max ) |
32 | | newHeight = Math.min( newHeight, max ); |
| 33 | // Allow a small amount of imprecision. |
| 34 | if ( Math.abs( delta ) > 18 ) |
| 35 | { |
| 36 | newHeight = currentHeight + delta; |
| 37 | var min = editor.config.autoGrow_minHeight, |
| 38 | max = editor.config.autoGrow_maxHeight; |
| 39 | |
| 40 | ( min == undefined ) && ( editor.config.autoGrow_minHeight = min = 200 ); |
| 41 | if ( min ) |
| 42 | newHeight = Math.max( newHeight, min ); |
| 43 | if ( max ) |
| 44 | newHeight = Math.min( newHeight, max ); |
34 | | if ( newHeight != currentHeight ) |
35 | | { |
36 | | newHeight = editor.fire( 'autoGrow', { currentHeight : currentHeight, newHeight : newHeight } ).newHeight; |
37 | | editor.resize( editor.container.getStyle( 'width' ), newHeight, true ); |
38 | | } |
| 46 | if ( newHeight != currentHeight ) |
| 47 | { |
| 48 | newHeight = editor.fire( 'autoGrow', { currentHeight : currentHeight, newHeight : newHeight } ).newHeight; |
| 49 | resizeable.setStyle( 'height', newHeight + 'px' ); |
| 50 | editor.fire( 'resize' ); |
| 51 | } |
| 52 | } |