bobroid / yii2-imperavi-redactor
Imperavi Redactor WYSIWYG 窗体小部件 (OEM 许可证适用于 Yii 2)
dev-master
2022-03-04 23:06 UTC
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-10-02 10:28:18 UTC
README
为 Experitus 创建
ImperaviRedactorWidget
是 Imperavi Redactor 的包装器,一个高质量的 WYSIWYG 编辑器。
请注意,Imperavi Redactor 本身是专有商业版权软件,但由于 Yii 社区购买了 OEM 许可证,您可以在 Yii 中免费使用它。
使用模型
yii\imperavi\Widget::widget([ // You can either use it for model attribute 'model' => $my_model, 'attribute' => 'my_field', // or just for input field 'attribute' => 'my_input_name', // Some options, see http://imperavi.com/redactor/docs/ 'options' => [ 'toolbar' => false, 'css' => 'wym.css', ], ]);
使用 ActiveForm
use yii\imperavi\Widget; use yii\widgets\ActiveForm; $form = ActiveForm::begin(); echo $form->field($model, 'my_field')->widget(Widget::classname(), 'options' => []);
或者,您也可以通过调用
yii\imperavi\Widget::widget([ // Some options, see http://imperavi.com/redactor/docs/ 'options' => [], ]);
将 redactor 插件与资源包一起插入。
yii\imperavi\Widget::widget([ 'options' => [ 'lang' => 'ru', ], 'plugins' => [ 'fullscreen', 'clips' ] ]);
安装
安装此扩展的首选方式是通过 composer。
运行以下命令
php composer.phar require asofter/yii2-imperavi-redactor "*"
或者
"asofter/yii2-imperavi-redactor": "*"
将以下内容添加到您的 composer.json
文件的 require 部分中。