Search code examples
yii2yii2-basic-appredactor

Yii2 change redactor box size


I'm using Yii2 Redactor box, extension from: https://github.com/yiidoc/yii2-redactor

I want to change size of the textarea but I don't know how, it not mention in their document. I've tried to edit their css but it didn't work.

Please help me with this. Thank you


Solution

  • Here's the way you can control the height of the text area:

    echo $form->field($curriculum,'text')->widget(Widget::className(),[
                                'settings' => [             
                                    'lang' => 'en',
                                    'minHeight' => 500,
                                    'plugins' => [
                                        'fullscreen', 'fontfamily','fontcolor','fontsize','imagemanager',                                       
                                    ],
                                    'buttons' => [
                                          'formatting', '|', 'bold', 'italic', 'deleted', '|', 
                                          'unorderedlist', 'orderedlist', 'outdent', 'indent', '|',
                                          'image', 'table', 'link', '|',
                                          'alignment', '|', 'horizontalrule',
                                          '|', 'underline', '|', 'alignleft', 'aligncenter', 'alignright', 'justify'
                                    ],
                                    'imageUpload'=>\Yii::$app->urlManager->createUrl('program/uploadcurriculumart'),
                                    'clipboardUpload'=>true,
                                    'clipboardUploadUrl'=>\Yii::$app->urlManager->createUrl('program/uploadcurriculumart'),
                                    'imageManagerJson'=>\Yii::$app->urlManager->createUrl('program/getallcurriculumart')
                                ]
                            ],['style' => 'height:500px;'])->label(false);  
    

    Notice the two arguments: minHeight and also I set the style for the control to have a height of 500px; Works perfectly.