CKEDITOR configuration overwrites other

1

On the same page I have 2 texarea. Being one of them is to be small and the other standard.

The default has autogrow and the small maximum height arrow of 100px.

The problem is that one setting overwrites the other.

if(cksize == "small"){
    CKEDITOR.config.height = 100;
    CKEDITOR.config.autoGrow_maxHeight = 100;
}else{
    CKEDITOR.config.height = 0;
    CKEDITOR.config.autoGrow_maxHeight = 0;
}

How can I pass these options on the json options?

CKEDITOR.replace(id, options);

Being within that options would have all settings and height.

    
asked by anonymous 09.03.2015 / 15:26

1 answer

1

The author of the question has probably solved your problem, but I'll leave you an answer for any similar questions. When calling CKEDITOR.config , you are telling CKEditor that you want to change the data for any instance of the CKEditor configured on the current page. That is, you will change the settings of the two instances that you have created. What you can do is, when creating the CKEditor instance in Textarea, store this instance in a variable. You could create and configure the two instances of this mode (taking into account that the smaller Textarea would have id='editor1' and default id='editor2' ):

var editor1 = CKEDITOR.replace('editor1');
var editor2 = CKEDITOR.replace('editor2');

editor1.config.height = 100;
editor1.config.autoGrow_maxHeight = 100;

editor2.config.height = 0;
editor2.config.autoGrow_maxHeight = 0;

This also eliminates the need for if .

    
13.11.2015 / 15:47