algsupport / yii2-imperavi-redactor
Imperavi Redactor WYSIWYG 小部件(针对 Yii 2 的 OEM 许可)
v0.0.3
2023-12-18 17:08 UTC
Requires
This package is auto-updated.
Last update: 2024-09-18 18:40:20 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' => []);
或者,您可以通过调用将 Redactor 附加到已存在的 DOM 元素
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 "*"
或者在您的 composer.json
文件的 require 部分添加
"asofter/yii2-imperavi-redactor": "*"