ValeriiVasin
ValeriiVasin

Reputation: 8706

CKEditor. How to turn off autogrow (set constant height)

I use autogrow plugin and have a need turn it of in some cases. And set constant height... but how can I do it? Didn't find any documentation about how to enable/disable plugins on the fly.

Upvotes: 2

Views: 6240

Answers (2)

V H
V H

Reputation: 8587

Thanks to codewaggle and

oleq jQuery UI Resizable in CKEditor

here is how I implemented their advice:

<form .....  onload="CKStart()">
.....
<div id="resizable" style="overflow: hidden; max-height:240px;">
    <ckeditor:editor name="content" id="myCKEditor" height="200px" width="100%" >
    </ckeditor:editor>
  </div>


...

</form>

<script>

function CKStart(){
  var editor = CKEDITOR.replace( 'myCKEditor', {
    autoGrow_onStartup: false,
        resize_enabled: false,
    height: '200px'

    });
}
</script>

It does appear to be working - no resize available

Upvotes: 0

codewaggle
codewaggle

Reputation: 4943

You can set the config for each instance.

The examples below include the configuration settings to turn off autogrow and to set a constant height by setting the height and disabling resize.

If you want to modify a bunch of config settings for a particular instance you can call a custom config file:

CKEDITOR.replace( 'textareaID',
{
  customConfig : 'customConfigSettingsA.js';
});

Otherwise just include the settings in the file when you create the instance.

CKEDITOR.replace( 'textareaID',
{
  config.autoGrow_onStartup = false,
  config.resize_enabled = false,
  config.height = '111px';
});

You can also load a custom config file that is shared and set specific settings at the same time:

CKEDITOR.replace( 'textareaID',
{
  customConfig : 'customConfigSettingsA.js',
  config.autoGrow_onStartup = false,
  config.resize_enabled = false,
  config.height = '111px';
});

See this post for additional config settings that control width, height, resizability and min/max size settings:

How to set and lock the CKEditor window size?

Upvotes: 2

Related Questions