using editors of yiibooster - fix issues - configuration

You are viewing revision #4 of this wiki article.
This version may not be up to date with the latest version.
You may want to view the differences to the latest version.

next (#5) »

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) 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 wnat 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'),