0

I need help here. I have a system developed with Yii framework. I have the CKEDITOR widget in Yii Booster. When user press the enter key, I want to have 'br'instead of 'p'.

Below is my script:

$this->widget('booster.widgets.TbCKEditor',array(
    'model'=>$model,           
    'attribute'=>'qualifications', 
    'editorOptions'=>array(
                    'enterMode'=> 'CKEDITOR.ENTER_BR',
                    ),
) ); 

However, when I run the script, it still gives me p instead of br. I have been looking for the solution for few days. Can anyone help me with this?

CnV
  • 381
  • 4
  • 20

2 Answers2

1

you can have solution from here https://github.com/2amigos/yii2-ckeditor-widget/issues/41

you need to use clientOptions like below:

$form->field($model, 'text')->widget(CKEditor::className(), [
        'options' => ['rows' => 6],
        'preset' => 'standard',
        'clientOptions'=>[
            'enterMode' => 2,
            'forceEnterMode'=>false,
            'shiftEnterMode'=>1
        ]
    ])

Hope this will help!

Ashok Chandrapal
  • 1,020
  • 7
  • 27
  • Thanks for the solution. However, because my form was created in Yii Booster, is there another way to solve this by using booster instead? – CnV Oct 10 '16 at 11:52
  • I think I solve it! Thanks so much Albert. I actually just need to change the enterMode option to 2. Thanks for your reference. It is a big help for me! – CnV Oct 10 '16 at 11:54
  • wc!. just accept answer and upvote it so user will get help if will have same issue :) – Ashok Chandrapal Oct 10 '16 at 11:55
0

Solution for this post:

$this->widget('booster.widgets.TbCKEditor',array(
    'model'=>$model,           
    'attribute'=>'qualifications', 
    'editorOptions'=>array(
                    'enterMode'=> 2,
                    ),
) ); 
CnV
  • 381
  • 4
  • 20