49 public function run() {
51 list($name, $id) = $this->resolveNameID();
55 $this->htmlOptions[
'id'] = $id;
57 if (!array_key_exists(
'style', $this->htmlOptions)) {
58 $this->htmlOptions[
'style'] =
"width:{$this->width};height:{$this->height};";
61 if ($this->hasModel()) {
62 echo CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
64 echo CHtml::textArea($name, $this->
value, $this->htmlOptions);
76 $booster->registerPackage(
'wysihtml5');
81 if (isset($this->editorOptions[
'locale'])) {
82 $booster->registerAssetJs(
83 'locales/bootstrap-wysihtml5.' . $this->editorOptions[
'locale'] .
'.js'
85 } elseif (in_array($this->lang, array(
'de-DE',
'es-ES',
'fr',
'fr-NL',
'pt-BR',
'sv-SE',
'it-IT'))) {
86 $booster->registerAssetJs(
'locales/bootstrap-wysihtml5.' . $this->lang .
'.js');
93 $options = CJSON::encode($this->editorOptions);
102 $script[] =
"$.fn.wysihtml5.defaultOptions.stylesheets = [];";
107 if (isset($this->editorOptions[
'deepExtend']) && $this->editorOptions[
'deepExtend'] ===
true) {
108 $script[] =
"$('#{$id}').wysihtml5('deepExtend', {$options});";
110 $script[] =
"$('#{$id}').wysihtml5({$options});";
113 Yii::app()->getClientScript()->registerScript(__CLASS__ .
'#' . $id, implode(
"\n", $script));
118 if (empty($this->editorOptions[
'color'])) {
123 array_unshift($this->editorOptions[
'stylesheets'], $defaultStyleSheetUrl);
128 if (empty($this->editorOptions[
'stylesheets'])) {
129 $this->editorOptions[
'stylesheets'] = array();
130 }
else if (is_array($this->editorOptions[
'stylesheets'])) {
131 $this->editorOptions[
'stylesheets'] = array_filter(
132 $this->editorOptions[
'stylesheets'],
135 }
else if (is_string($this->editorOptions[
'stylesheets'])) {
136 $this->editorOptions[
'stylesheets'] = array($this->editorOptions[
'stylesheets']);
139 $this->editorOptions[
'stylesheets'] = array();