Yii ExtCkeditor based in Ckeditor extension created by Ekstazi http://www.yiiframework.com/extension/ckeditor/
Requirements ¶
Tested in Yii 1.1.8
Usage ¶
Download ckeditor source http://ckeditor.com/download tested with 3.6.2 version, unzip in assets folder:
proteted/extensions/extckeditor/assets/ckeditor.js
proteted/extensions/extckeditor/assets/config.js
proteted/extensions/extckeditor/assets/lang/
... etc.
in the view
<?php $this->widget('application.extensions.extckeditor.ExtCKEditor', array(
'model'=>$model,
'attribute'=>'body', // model atribute
'language'=>'en', /* default lang, If not declared the language of the project will be used in case of using multiple languages */
'editorTemplate'=>'full', // Toolbar settings (full, basic, advanced)
)); ?>
Merge code?
Maybe it's better to merge code of these two? Ekstazi's one is now part of YiiExt: https://github.com/yiiext/ckeditor-widget
Error in line 90 undifined variable $language
There is an error in the code in setLanguage function I correcte it to $lang instead of $language that is not defined and it works fine.
Nice Widget it saved me time
Thank you
FIX
As per Gsoul's post, in EXTCKEditor.php, around line 90, it should be
if(isset($this->allowedLanguages[$lang])) $this->language=$lang;
Custom Toolbars
Note that there is no 'advanced' toolbar. You can add this custom toolbar using config.js, and will need to include this file yourself.
$cs->registerScriptFile($assets.'/config.js');
When first editing and saving the config.js, for some reason it was cacheing even after hard refreshes (locally), not sure why. Eventually the JS asset updated and the new toolbar was available. If you want to add other toolbar names, you will need to add to $allowedEditorTemplates
Also - Height Not Used
The height option is not used in makeOptions. I added
$options['height'] = $this->height;
Custom toolbar
The "advanced" toolbar is there to define 'custom' toolbars.
Example:
'editorTemplate'=>'advanced', 'toolbar'=>array( array('Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink','-','Image','Flash', '-', 'About') ),
how is it different?
You say "based in Ckeditor extension created by Ekstazi". In what way is it better/different from Ekstazi's extension?
disabled
how can I do my ckeditor disabled?
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.