This is the wrapper around the Redactor.
Important This library is NOT free to use. Community license for it was generously bought by the Yii community and so you can use this widget legally in Yii-based projects ONLY.
Basic example of usage is this:
$this->widget( 'booster.widgets.TbRedactorJs', [ 'name' => 'some_name', 'value' => '<b>Here is the text which will be put into editor view upon opening.</b>', ] );
Please note that the
name is set to "content", which is required for Redactor plugin to fetch the original data from input
and paste it into its editor view.
If you do not set "name" or set it to any other value, the value of
value property of this widget
will be completely ignored!
In addition to previous note, if you have several Redactor instances on the same page, you must use the
property to set the HTML ID of each Redactor instance to different values.
Here's all configuration properties which you can set for
Most of them are common to all form input widgets.
The data model associated with this widget.
Either this property along with
If you set the
The value of
Here you can force the initial value of the input.
HTML attributes of the input tag itself. Please note that it is not the attributes of a wrapper tag around the input. See CInputWidget.htmlOptions.
Options for the original library.
This value will be JSON-encoded and fed to
$this->widget( 'booster.widgets.TbRedactorJs', [ 'name' => 'another_text', 'value' => 'Hover over the toolbar buttons to see whether it is really in Korean!', 'editorOptions' => [ 'lang' => 'ko', 'plugins' => ['fontfamily', 'textdirection'] ], ] );