#9351 closed New Feature (invalid)
Autogrow support for divarea plugin — at Version 11
Reported by: | jgallred | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | 4.0 |
Keywords: | Cc: |
Description (last modified by )
It would be nice if the autoGrow_minimumHeight property would work with the divarea plugin. Currently it does not.
Please see attached file _divarea_autogrow.html
. According to my tests it works exactly the same as autogrow for iframe based editor.
Change History (11)
comment:1 Changed 12 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 Changed 12 years ago by
I appreciate you taking the time to help me understand. When I run the following code from the console on http://nightly-v4.ckeditor.com/3520/samples/divarea.html, it does not have a min or max height enforced.
CKEDITOR.instances.editor1.destroy(); CKEDITOR.replace( 'editor1', { extraPlugins: 'divarea,autogrow', autoGrow_minHeight : 400, autoGrow_maxHeight : 800, removePlugins: 'resize' });
Is this related to the paragraph you wrote?
Please note that if you have defined config.extraPlugins= 'autogrow'; and then checked divarea sample this will not work. Sample divarea has extraPlugins: 'divarea' setting on page and it will overwrite the one in config.js.
I was very confused by the wording. I understand that extraPlugins overwrites the config.extraPlugins, but what does that have to do with the divarea sample page, where config is not used?
comment:3 Changed 12 years ago by
but what does that have to do with the divarea sample page, where config is not used?
Options from config.js file are applicable for all instances of CKEditor. Setting in replace mentod are used for one particular instance and have higher priority then setting from config.js.
It would be nice if the autoGrow_minimumHeight property would work with the divarea plugin. Currently it does not.
If I didn't understand you correctly, please explain what the problem is - what steps need to be taken to reproduce, what is the expected result and what is actual result.
comment:4 Changed 12 years ago by
Sorry I was not clearer.
Steps to Reproduce
- Go to [http://nightly-v4.ckeditor.com/3520/samples/divarea.html]
- Open the browser console
- Run the command
CKEDITOR.instances.editor1.destroy();
- Run the command
CKEDITOR.replace( 'editor1', { extraPlugins: 'divarea,autogrow', autoGrow_minHeight : 400, autoGrow_maxHeight : 800, removePlugins: 'resize' });
- Delete all content in the CKEditor instance
Desired behavior: The CKEditor div should not get any smaller than 400px. If you hold down enter, the div should not get bigger than 800px. Basically, the autogrow behavior of CKEditor with using the divarea plugin.
Actual behavior: The CKEditor div collapses to one line. If you hold down enter, the div expands infinitely.
The div min and max height could be manipulated via CSS, but I just thought it would be convenient if the autogrow plugin handled the case where the divarea plugin is in use.
comment:5 Changed 12 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Ok, I'm not sure how have I got it working before but it seems that there are problems with autogrow settings and divarea plugin.
comment:6 Changed 12 years ago by
Status: | reopened → confirmed |
---|---|
Type: | New Feature → Bug |
comment:7 Changed 12 years ago by
Milestone: | → CKEditor 4.0 |
---|---|
Summary: | Autogrow config support for divarea plugin → Autogrow support for divarea plugin |
Type: | Bug → New Feature |
Version: | 4.0 Beta → 4.0 (GitHub - master) |
Divarea belongs to the inline-editing family, for which the autogrow feature hasn't been implemented yet. At the moment height:auto is the default behavior for inline editing.
comment:8 Changed 12 years ago by
Milestone: | CKEditor 4.0 |
---|---|
Resolution: | → invalid |
Status: | confirmed → closed |
Auto grow is a iframe wysiwyg dedicated feature which conquers the iframe layout limitation thus are inapplicable to the inline editing environment.
This requirement can be easily achieved on editable via "min-height"/"max-height" page CSS style in all supported browsers.
comment:9 Changed 12 years ago by
Autogrow in divarea plugin can be achieved with the following settings:
- Put this in head section of divarea.html sample (if you want editor to grow to certain height)
<style> .cke_wysiwyg_div { min-height: 200px; max-height: 600px; } </style>
- Use the below definition sole (if you want editor to grow endlessly) or with above rule
CKEDITOR.replace( 'editor1', { extraPlugins: 'divarea', height : 'auto' });
Property min-height should be supported in all browsers even IE7 - http://www.quirksmode.org/css/contents.html
comment:11 Changed 12 years ago by
Description: | modified (diff) |
---|
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; } }); });
What you talk about is
autoGrow_minHeight
option and it works.All you have to do is use this code on page:
Please note that if you have defined
config.extraPlugins= 'autogrow';
and then checked divarea sample this will not work. Sample divarea hasextraPlugins: 'divarea'
setting on page and it will overwrite the one in config.js.I closing this ticket as I think it is invalid. If you have other problem/request with this configuration option, please provide more detailed description and I will reopen it.
If this was your problem then it would be nice if you could leave a comment.