Changeset 6921 for CKEditor/trunk
- Timestamp:
- 05/11/11 19:05:03 (2 years ago)
- Location:
- CKEditor/trunk
- Files:
-
- 3 edited
-
CHANGES.html (modified) (1 diff)
-
_source/plugins/autogrow/plugin.js (modified) (1 diff)
-
_source/themes/default/theme.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
CKEditor/trunk/CHANGES.html
r6920 r6921 51 51 <li><a href="http://dev.ckeditor.com/ticket/6263">#6263</a> : Some of the table cell's context menu options may be incorrectly disabled.</li> 52 52 <li><a href="http://dev.ckeditor.com/ticket/6247">#6247</a> : Focus restores properly after float panel is closed.</li> 53 <li><a href="http://dev.ckeditor.com/ticket/7173">#7173</a> : Enhancement to "autogrow" plugin makes it more accurate on editor size.</li> 53 54 <li>Updated the following language files:<ul> 54 55 <li><a href="http://dev.ckeditor.com/ticket/7834">#7834</a> : Dutch;</li> -
CKEditor/trunk/_source/plugins/autogrow/plugin.js
r6428 r6921 8 8 */ 9 9 (function(){ 10 var resizeEditor = function( editor )11 {12 if ( !editor.window )13 return;14 var doc = editor.document,15 currentHeight = editor.window.getViewPaneSize().height,16 newHeight;17 10 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 else24 newHeight = doc.getDocumentElement().$.offsetHeight;25 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 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 }39 };40 11 CKEDITOR.plugins.add( 'autogrow', 41 12 { 42 13 init : function( editor ) 43 14 { 15 var lastContentHeight; 16 var resizeEditor = function( editor ) 17 { 18 if ( !editor.window ) 19 return; 20 21 var doc = editor.document, 22 resizeable = editor.getResizable( 1 ), 23 body = doc.getBody().$, 24 htmlElement = doc.getDocumentElement().$, 25 currentHeight = resizeable.$.offsetHeight, 26 newHeight; 27 28 var delta = 29 // Delta height by checking scrollHeight. 30 ( CKEDITOR.env.ie && CKEDITOR.env.quirks ? body.scrollHeight - body.clientHeight 31 : htmlElement.scrollHeight - ( htmlElement.clientHeight || htmlElement.offsetHeight ) ) 32 // Negative scrollHeight (content reduced) is not supported in some browsers, figure it out by watching over the content size. 33 || ( body.clientHeight < lastContentHeight ? body.clientHeight - lastContentHeight : 0 ); 34 35 if ( delta ) 36 { 37 newHeight = currentHeight + delta; 38 var min = editor.config.autoGrow_minHeight, 39 max = editor.config.autoGrow_maxHeight; 40 41 ( min == undefined ) && ( editor.config.autoGrow_minHeight = min = 200 ); 42 if ( min ) 43 newHeight = Math.max( newHeight, min ); 44 if ( max ) 45 newHeight = Math.min( newHeight, max ); 46 47 if ( newHeight != currentHeight ) 48 { 49 newHeight = editor.fire( 'autoGrow', { currentHeight : currentHeight, newHeight : newHeight } ).newHeight; 50 resizeable.setStyle( 'height', newHeight + 'px' ); 51 editor.fire( 'resize' ); 52 } 53 } 54 55 lastContentHeight = body.clientHeight; 56 }; 57 44 58 for ( var eventName in { contentDom:1, key:1, selectionChange:1, insertElement:1 } ) 45 59 { -
CKEditor/trunk/_source/themes/default/theme.js
r6723 r6921 353 353 * is mainly used by the resize plugin, which adds a UI handle that can be used 354 354 * to resize the editor. 355 * @param {Boolean} forContents Whether to return the "contents" part of the theme instead of the container. 355 356 * @returns {CKEDITOR.dom.element} The resizable element. 356 357 * @example 357 358 */ 358 CKEDITOR.editor.prototype.getResizable = function( )359 CKEDITOR.editor.prototype.getResizable = function( forContents ) 359 360 { 360 return this.container;361 return forContents ? CKEDITOR.document.getById( 'cke_contents_' + this.name ) : this.container; 361 362 }; 362 363
Note: See TracChangeset
for help on using the changeset viewer.
