Another CKEditor extension that uses the parameters based on CKEditor API.
-- Changes in version 0.1 --
- Fix errors when using array as value in editorOptions
- Add support for javascript code in editorOptions
Resources ¶
Documentation ¶
Requirements ¶
- Yii 1.0.5 or above
Installation ¶
- Extract the release file under
protected/extensions
Usage ¶
See the following code example:
$this->widget(
'application.extensions.NHCKEditor.CKEditorWidget',
array(
// [Required] CModel object
'model' => $model,
'attribute' => 'ATTRIBUTE_NAME',
// [Optional] CSS file to be included
'cssFile' => Yii::app()->request->baseURL.'/css/YOUR_FILE.css',
// [Optional] Options based on CKEditor API documentation
'editorOptions' => array(
// Now supports PHP array and javascript code (must begin with js:)
//'width' => 800,
//'height' => 480,
//'language' => 'th',
//'toolbar' => 'Full', // format #1: String
//'toolbar' => array( // format #2: PHP array
// array('Source', '-', 'Save')
//),
//'toolbar' => "js:[ // format #3: javascript code
// ['Source', '-', 'Save']
//]",
//'uiColor' => '',
// ... your own options
),
// [Optional] htmlOptions based on Yii implementation
'htmlOptions' => array(
//
),
)
);
Change Log ¶
December 18, 2009 ¶
- Fix an error when using array as value in editorOptions (thanks @gazbond for his comment)
- Add support for javascript code in editorOptions
November 2, 2009 ¶
- Initial release. v0.1b
Visibility of properties must be public
In order for this widget to work with 1.1.3, the visibility of the protected properties ($editorOptions, etc) of CKEditorWidget must be changed from protected to public.
1.1.3
it does not works with 1.1.3
properity editorOptions is not defined.
Usage with CActiveForms
CKEditor also works in combination with Ajax, e.g. a CActiveForm. For more information:
Forum topic on CKEditor with CActiveForm
will be fixed soon
@gazbond thanks for your help. I'll fix this in the next version.
Does not pass nested arrays or JSON strings
You cannot configure like:
array('Styles', 'Format'), array('Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', '-', 'About')
)
),
Or like:
\['Styles', 'Format'], \['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', '-', 'About']
]"
),
The first produces the following javascript:
And the second:
\['Styles', 'Format'], \['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', '-', 'About']
]'
Notice the leading single quote.
I think you should add the following to CKEditorWidget->jsOptions():
You can then use php arrays.
Configuration of uploading folder
Hello, thanks for this very good and useful extension.
I use it to combine CKEditor and CKFinder, I only pass path to CKFinder script bellow "// ... your own options" line.
However, is there any option to configure where images and other will be uploaded by CKFinder? In CKFinder main configuration, there is one properity $baseUrl where you can do that. Default is '/ckfinder/userfiles/'.
However, that confiuration script does not understand Yii coined urls like Yii::app()->baseUrl; and similar. Also, I don't like to mess up with this config script, especially if I'll use it for several webpages.
So, is there any possibility to set this from widget? Does anyone have experience with this?
Enable disable editor
Hi
who enable or disable editor?
i pass html_options array('readonly'=>'readonly') but not work
SOLVED ReadOnly Editor
... 'editorOptions' => array( ... 'width' => 500, ... 'readOnly'=>true/false, // here !!!!!!
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.