Yii 1.1: using editors of yiibooster - fix issues - configuration


if you have use the yiibooster extension, you have definitely used the amazing redactor, html5 and ckEditor editors.

I didn't found a really good documentation how to configure them (about Yii), so for the redactor and html5Editor I summarized the below code

for html5Editor

echo $form->html5EditorRow($model, 'your_model_attribute', array('class' => 'span4', 'rows' => 5, 'height' => '300px',
    'options' => array( //you could set to false any button that is not desired
        'font-styles' => true,
        'emphasis' => true,
        'lists' => true,
        'link' => true,
        'image' => true,
        'html' => true,
        'color' => true,

for redactor I found few appearance bugs. In my case (I don't know if it is generally issue) the text editor cursor and the textarea box border not displayed. So users cannot see where they can enter the text.

therefore I add some css using registerCss (you could also set these in css file directly)

Yii::app()->clientScript->registerCss('redactor-fix', '.redactor_editor {width:100%;} .redactor_box {overflow:hidden;} ');
//you could remove some items of array that you do not want to appeared on text editor
  echo $form->redactorRow($model, 'your_model_attribute', array('class' => 'span4', 'rows' => 5, 'width' => '100%',
  'options' => array(
  'minHeight' => 300,
  'buttons' => array('html', '|', 'formatting', '|', 'bold', 'italic', 'deleted', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', '|',
  'image', 'video', 'file', 'table', 'link', '|',
  'fontcolor', 'backcolor', '|', 'alignment', '|', 'horizontalrule',
  '|', 'underline', '|', 'alignleft', 'aligncenter', 'alignright', 'justify'),

Be the first person to leave a comment

Please to leave your comment.

Write new article