public function run() { parent::run(); // Saves $id will be the id of the element that ckeditor will target list($name, $id) = $this->resolveNameID(); // Publish assets to public directory $baseDir = dirname(__FILE__); $assets = Yii::app()->getAssetManager()->publish($baseDir . DIRECTORY_SEPARATOR . 'assets'); $cs = Yii::app()->getClientScript(); $cs->registerScriptFile($assets . '/ckeditor.js'); echo CHtml::activeTextArea($this->model, $this->attribute, array('rows' => 10, 'cols' => 70)); $this->options = array_merge(array('filebrowserBrowseUrl' => array('/backend/elfinderBrowse'), 'height' => '250px', 'allowedContent' => true), $this->options); $this->setConfig($this->options); $this->ECKE->replace($id, $this->_config); }
public function run() { parent::run(); list($name, $id) = $this->resolveNameID(); $baseDir = dirname(__FILE__); $assets = Yii::app()->getAssetManager()->publish($baseDir . DIRECTORY_SEPARATOR . 'assets'); $cs = Yii::app()->getClientScript(); $cs->registerScriptFile($assets . '/ckeditor.js'); $this->htmlOptions['id'] = $id; // $this->htmlOptions['class'] = 'ckeditor'; if (!array_key_exists('style', $this->htmlOptions)) { $this->htmlOptions['style'] = "width:{$this->width};height:{$this->height};"; } if (!array_key_exists('cols', $this->htmlOptions)) { $this->htmlOptions['cols'] = self::COLS; } if (!array_key_exists('rows', $this->htmlOptions)) { $this->htmlOptions['rows'] = self::ROWS; } $options = $this->makeOptions(); $js = <<<EOP CKEDITOR.replace('{$name}',{$options}); EOP; $cs->registerScript('Yii.' . get_class($this) . '#' . $id, $js, CClientScript::POS_LOAD); if ($this->hasModel()) { $html = CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions); } else { $html = CHtml::textArea($name, $this->value, $this->htmlOptions); } echo $html; }
/** * 运行 */ public function run() { parent::run(); $assets = $this->getAssetsPath(); $clientScript = Yii::app()->getClientScript(); $clientScript->registerScriptFile($assets . '/ueditor.config.js', CClientScript::POS_END); $clientScript->registerScriptFile($assets . '/ueditor.all.min.js', CClientScript::POS_END); $clientScript->registerScriptFile($assets . '/lang/' . $this->language . '.js', CClientScript::POS_END); $clientScript->registerScript('content', $this->makeOptions(), CClientScript::POS_END); }
/** * 运行 */ public function run() { parent::run(); $this->assets = $assets = $this->getAssetsPath(); $this->displayHtml(); $clientScript = Yii::app()->getClientScript(); $clientScript->registerCssFile($assets . '/default.css'); $clientScript->registerScriptFile($assets . '/resumable.js', CClientScript::POS_END); $clientScript->registerScriptFile($assets . '/upload.js', CClientScript::POS_END); }
public function run() { parent::run(); $assets = $this->getAssetsPath(); $cs = Yii::app()->getClientScript(); $cs->registerCssFile($assets . '/themes/default/default.css'); $cs->registerCssFile($assets . '/plugins/code/prettify.css'); $cs->registerScriptFile($assets . '/kindeditor.js', CClientScript::POS_HEAD); $cs->registerScriptFile($assets . '/lang/zh_CN.js', CClientScript::POS_HEAD); $cs->registerScriptFile($assets . '/plugins/code/prettify.js', CClientScript::POS_HEAD); $cs->registerScript('content', $this->makeOptions(), CClientScript::POS_HEAD); }
public function run() { parent::run(); list($name, $id) = $this->resolveNameID(); $assets = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets'); $options = $this->makeOptions(); $cs = Yii::app()->getClientScript(); $cs->registerScriptFile($assets . '/ckeditor.js'); $this->htmlOptions['id'] = $id; $js = <<<EOP CKEDITOR.replace('{$name}',{$options}); EOP; $cs->registerScript('Yii.' . get_class($this) . '#' . $id, $js, CClientScript::POS_LOAD); if ($this->hasModel()) { $html = CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions); } else { $html = CHtml::textArea($name, $this->value, $this->htmlOptions); } echo $html; }
/** * Init widget */ public function run() { parent::run(); list($name, $id) = $this->resolveNameID(); $baseDir = dirname(__FILE__); $assets = Yii::app()->getAssetManager()->publish($baseDir . DIRECTORY_SEPARATOR . 'markitup' . DIRECTORY_SEPARATOR . 'markitup'); $cs = Yii::app()->getClientScript(); $widgetPath = Yii::getPathOfAlias('widgets.markitup.markitup.markitup.sets.' . $this->editorType); $cs->registerScriptFile($assets . '/jquery.markitup.js', CClientScript::POS_END); $cs->registerScriptFile($assets . '/sets/' . $this->editorType . '/set.js', CClientScript::POS_END); $cs->registerCssFile($assets . '/skins/simple/style.css'); $cs->registerCssFile($assets . '/sets/' . $this->editorType . '/style.css'); if ($this->hasModel()) { $html = CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions); } else { $html = CHtml::textArea($name, $this->value, $this->htmlOptions); } $js = "\$('#{$id}').markItUp(mySettings);"; $cs->registerScript('Yii.' . get_class($this) . '#' . $id, $js, CClientScript::POS_READY); echo $html; }
/** * 运行 */ public function run() { parent::run(); $assets = $this->getAssetsPath(); $clientScript = Yii::app()->getClientScript(); $clientScript->registerCssFile($assets . '/themes/default/default.css'); $clientScript->registerScriptFile($assets . '/kindeditor-min.js', CClientScript::POS_END); $clientScript->registerScriptFile($assets . '/lang/' . $this->language . '.js', CClientScript::POS_END); $clientScript->registerScript('content', $this->makeOptions(), CClientScript::POS_END); }
public function run() { parent::run(); $this->widget('bootstrap.widgets.TbCKEditor', array('model' => $this->model, 'attribute' => $this->attribute, 'editorOptions' => $this->options)); }
public function run() { parent::run(); $assets = $this->assets; // here any option is overriden by user's options list($name, $id) = $this->resolveNameID(); $options = $this->makeOptions(); $cs = Yii::app()->getClientScript(); $this->htmlOptions['id'] = $id; if (!array_key_exists('style', $this->htmlOptions)) { $this->htmlOptions['style'] = "width:{$this->width};height:{$this->height};"; } if (!array_key_exists('cols', $this->htmlOptions)) { $this->htmlOptions['cols'] = self::COLS; } if (!array_key_exists('rows', $this->htmlOptions)) { $this->htmlOptions['rows'] = self::ROWS; } $js = <<<EOP CKEDITOR.replace('{$name}',{$options}); EOP; $cs->registerScript('Yii.' . get_class($this) . '#' . $id, $js, CClientScript::POS_LOAD); if ($this->hasModel()) { $html = CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions); } else { $html = CHtml::textArea($name, $this->value, $this->htmlOptions); } echo $html; }
public function run() { parent::run(); list($name, $id) = $this->resolveNameID(); $baseDir = dirname(__FILE__); $assets = Yii::app()->getAssetManager()->publish($baseDir . DIRECTORY_SEPARATOR . 'assets'); $options = $this->makeOptions(); $cs = Yii::app()->getClientScript(); $cs->registerScriptFile($assets . '/ckeditor/ckeditor.js'); $cs->registerScriptFile($assets . '/AjexFileManager/ajex.js'); $cs->registerScriptFile($assets . '/clone.js'); $this->htmlOptions['id'] = $id; if (!array_key_exists('style', $this->htmlOptions)) { $this->htmlOptions['style'] = "width:{$this->width};height:{$this->height};"; } if (!array_key_exists('cols', $this->htmlOptions)) { $this->htmlOptions['cols'] = self::COLS; } if (!array_key_exists('rows', $this->htmlOptions)) { $this->htmlOptions['rows'] = self::ROWS; } $js = <<<EOP CKEDITOR.ELEMENT_MODE_REPLACE=true; var ckeditor = CKEDITOR.replace('{$name}',{$options}); var {$id}_afm=clone(AjexFileManager); {$id}_afm.init({ \treturnTo: 'ckeditor', \teditor: ckeditor, \tpath: '{$assets}/AjexFileManager/', }); EOP; $cs->registerScript('Yii.' . get_class($this) . '#' . $id, $js, CClientScript::POS_LOAD); Yii::app()->clientScript->registerScript('Yii.' . get_class($this) . '#' . $id, "var CKEDITOR_BASEPATH='{$assets}/ckeditor/'", CClientScript::POS_BEGIN); if ($this->hasModel()) { $html = CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions); } else { $html = CHtml::textArea($name, $this->value, $this->htmlOptions); } echo $html; }
/** * Run the widget */ public function run() { parent::run(); }
public function run() { parent::run(); list($name, $id) = $this->resolveNameID(); $baseDir = dirname(__FILE__); $assets = Yii::app()->getAssetManager()->publish($baseDir . DIRECTORY_SEPARATOR . 'assets'); $options = $this->makeOptions(); $cs = Yii::app()->getClientScript(); $cs->registerScriptFile($assets . '/ckeditor.js'); $cs->registerScriptFile($assets . '/ckfinder/ckfinder.js'); $this->htmlOptions['id'] = $id; // $this->htmlOptions['fmt'] = 'fck'; if (!array_key_exists('style', $this->htmlOptions)) { $this->htmlOptions['style'] = "width:{$this->width};height:{$this->height};"; } if (!array_key_exists('cols', $this->htmlOptions)) { $this->htmlOptions['cols'] = self::COLS; } if (!array_key_exists('rows', $this->htmlOptions)) { $this->htmlOptions['rows'] = self::ROWS; } $js = <<<EOP function loadCKE_{$id}(){ CKEDITOR.replace('{$name}',{$options}); } CKFinder.setupCKEditor(CKEDITOR, '{$assets}/ckfinder/'); EOP; //$cs->registerScript('Yii.'.get_class($this).'#'.$id, $js, CClientScript::POS_LOAD); if ($this->onLoad) { $cs->registerScript('Yii.' . get_class($this) . '#' . $id, $js . "loadCKE_" . $id . "();", CClientScript::POS_LOAD); } else { $cs->registerScript('Yii.' . get_class($this) . '#' . $id, $js, CClientScript::POS_LOAD); } if ($this->hasModel()) { $html = ""; if (!$this->onLoad) { $html = CHtml::button("Turn on EDITOR", array("onClick" => "loadCKE_" . $id . "();")); } $html .= CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions); } else { if (isset($_POST[$name])) { $this->value = $_POST[$name]; } $html = ""; if (!$this->onLoad) { $html = CHtml::button("Turn on EDITOR", array("onClick" => "loadCKE_" . $id . "();")); } $html = CHtml::textArea($name, $this->value, $this->htmlOptions); } echo $html; }
public function run() { parent::run(); list($name, $id) = $this->resolveNameID(); $baseDir = dirname(__FILE__); $assets = Yii::app()->getAssetManager()->publish($baseDir . DIRECTORY_SEPARATOR . 'assets'); $options = $this->makeOptions(); $cs = Yii::app()->getClientScript(); $cs->registerScriptFile($assets . '/ckeditor.js'); $this->htmlOptions['id'] = $id; if (!array_key_exists('style', $this->htmlOptions)) { $this->htmlOptions['style'] = "width:{$this->width};height:{$this->height};"; } if (!array_key_exists('cols', $this->htmlOptions)) { $this->htmlOptions['cols'] = self::COLS; } if (!array_key_exists('rows', $this->htmlOptions)) { $this->htmlOptions['rows'] = self::ROWS; } if ($this->editorTemplate == 'basic') { $js = <<<EOP CKEDITOR.replace('{$name}', { toolbarGroups : [ \t \t\t{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] }, \t\t{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] }, \t\t{ name: 'styles' }, \t\t{ name: 'colors' }], \t\theight: '{$this->height}'}); EOP; } else { $js = <<<EOP CKEDITOR.replace('{$name}',{$options}); EOP; } $cs->registerScript('Yii.' . get_class($this) . '#' . $id, $js, CClientScript::POS_LOAD); if ($this->hasModel()) { $html = CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions); } else { $html = CHtml::textArea($name, $this->value, $this->htmlOptions); } echo $html; $js_conf = <<<EOP if(typeof CKEDITOR !== 'undefined') { \t\t\t\t \tCKEDITOR.on( 'instanceReady', function( ev ) { \t\t// Output paragraphs as <p>Text</p>. \t\tev.editor.dataProcessor.writer.setRules( '*', { \t\t\tindent: false, \t\t\tbreakBeforeOpen: true, \t\t\tbreakAfterOpen: false, \t\t\tbreakBeforeClose: false, \t\t\tbreakAfterClose: true \t\t}); \t}); } EOP; $cs->registerScript('body', $js_conf, CClientScript::POS_LOAD); }
public function run() { parent::run(); // Saves $id will be the id of the element that ckeditor will target list($name, $id) = $this->resolveNameID(); // Publish assets to public directory $baseDir = dirname(__FILE__); $assets = Yii::app()->getAssetManager()->publish($baseDir . DIRECTORY_SEPARATOR . 'assets'); $cs = Yii::app()->getClientScript(); $cs->registerScriptFile($assets . '/ckeditor.js'); echo CHtml::activeTextArea($this->model, $this->attribute, array('rows' => 10, 'cols' => 70)); $this->ECKE->replace($id, $this->_config); }