<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}

/**
 * Description
 *
 * @author Igor Ratsun
 */
class Rtgc_texteditor extends \Rtgc_textarea
{

    protected $options = array(
        'class'     => 'texteditor',
        'rows'      => 10,
        'maxlength' => 21844,
        'toolbar'   => 'RTpanel',
    );
    
    protected $field_xss_clean = false;

    public function field($name = '', $value = NULL)
    {
        $ci = & get_instance();
        $ci->load->library('ciext/ciext')->load_jquery();
        $ci->js_css->add_js('/assets/plugins/ckeditor/ckeditor.js');
        $ci->js_css->add_js('/assets/plugins/ckeditor/adapters/jquery.js');
        $ci->js_css->add_js_string('$(function(){$(".' . $this->options['class'] . '").ckeditor({toolbar:\'' . $this->options['toolbar'] . '\'});});');

        return parent::field($name, $value);
    }

}
