Changes between Initial Version and Version 11 of Ticket #9351


Ignore:
Timestamp:
Oct 26, 2012, 10:29:08 AM (12 years ago)
Author:
Jakub Ś
Comment:

One more thing. Besides styles and setting height to auto there is still some JavaScript needed to properly handle modes (source/wysiwyg) changes and maximize functionality.
Please see attached file for more details - _divarea_autogrow.html​.
Below is the code that needs to be inserted into page:

editor.on( 'instanceReady', function( e ) {				
				var contentDiv = document.getElementById( 'cke_' +editor.name ).getElementsByTagName( 'div' )[0];
				var contentParent = contentDiv.parentNode;				
				var computedHeight;	
								
				editor.on( 'beforeModeUnload', function( evt ) {  
					if ( evt.editor.mode == 'wysiwyg' && evt.editor.getCommand( 'maximize' ).state == CKEDITOR.TRISTATE_OFF )
						computedHeight = window.getComputedStyle(contentDiv,null).getPropertyValue("height");						
						computedHeight = (computedHeight == '100%') ? window.getComputedStyle(contentParent,null).getPropertyValue("height") : computedHeight;
				});	
				
				editor.on( 'mode', function( evt ) {				
					if ( evt.editor.mode == 'source' && evt.editor.getCommand( 'maximize' ).state == CKEDITOR.TRISTATE_OFF ) 	
						contentParent.getElementsByTagName( 'textarea' )[0].style.height = computedHeight;
				});
				
				editor.on( 'beforeCommandExec', function( evt ) {  
					if( evt.data.name == 'maximize' && evt.editor.mode == 'source' ) {						
						if( evt.editor.getCommand( 'maximize' ).state == CKEDITOR.TRISTATE_OFF ) {							
							contentParent.getElementsByTagName( 'textarea' )[0].style.height = '100%';
						} else 
							contentParent.getElementsByTagName( 'textarea' )[0].style.height = computedHeight;								
							
					} else if ( evt.data.name == 'maximize' && evt.editor.mode == 'wysiwyg' ) {
						computedHeight = window.getComputedStyle(contentDiv,null).getPropertyValue("height");						
						computedHeight = (computedHeight == '100%') ? window.getComputedStyle(contentParent,null).getPropertyValue("height") : computedHeight;								
					}
				});
			});

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #9351

    • Property Status changed from new to closed
    • Property Resolution changed from to invalid
    • Property Summary changed from Autogrow config support for divarea plugin to Autogrow support for divarea plugin
    • Property Version changed from 4.0 Beta to 4.0 (GitHub - master)
  • Ticket #9351 – Description

    initial v11  
    11It would be nice if the autoGrow_minimumHeight property would work with the divarea plugin. Currently it does not.
     2
     3----
     4
     5Please see attached file {{{_divarea_autogrow.html​}}}. According to my tests it works exactly the same as autogrow for iframe based editor.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy