bestyii/yii2-ueditor-plus
最新稳定版本:3.9.0
Composer 安装命令:
composer require bestyii/yii2-ueditor-plus
包简介
UEditor Plus 基于 UEditor 二次开发的富文本编辑器,让UEditor重新焕发活力
关键字:
README 文档
README
基于 UEditor 二次开发的富文本编辑器,让UEditor重新焕发活力, 是一套开源的在线HTML编辑器,主要用于让用户在网站上获得所见即所得编辑效果,开发人员可以用 UEditor 把传统的多行文本输入框(textarea)替换为可视化的富文本输入框。 UEditorPlus 使用 JavaScript 编写,本扩展已完美实现与 Yii2 的兼容开发。
本组件包版本号引用UEditorPlus版本号,方便对齐.
安装:
使用 composer 下载:
# 3.x(yii >= 2.0.16):
composer require bestyii/yii2-ueditor-plus:"~3.9"
# 开发版:
composer require bestyii/yii2-ueditor-plus:"dev-master"
使用:
在Controller中添加:
public function actions() { return [ 'UeUpload' => [ 'class' => 'bestyii\ueditor\plus\UEditorPlusUpload', // 可选参数, 参考 config.php 'config' => [ 'imageMaxSize' => 1*1024*1024, 'imageAllowFiles' => ['.png', '.jpg', '.jpeg', '.gif', '.bmp'], 'imagePathFormat' => '/uploads/image/{yyyy}{mm}/{yy}{mm}{dd}_{hh}{ii}{ss}_{rand:4}', 'thumbStatus' => false, 'thumbWidth' => 300, 'thumbHeight' => 200, 'thumbMode' => 'outbound', ], ], ]; }
在View中添加:
// 1. 简单调用(基于模型): $form->field($model, 'content')->widget('bestyii\ueditor\plus\UEditorPlus'); // 2. 带参数调用(此模式下仅`$editorOptions`参数可用): $form->field($model, 'content')->widget('bestyii\ueditor\plus\UEditorPlus',[ 'editorOptions' => [ 'initialFrameWidth' => 1000, 'initialFrameHeight' => 500, ], ]); // 3. 不带`$model`调用(已列出所有可用参数, 可适当忽略): \bestyii\ueditor\plus\UEditorPlus::widget([ 'id' => 'editor', 'attribute' => 'content', //'name' => 'content', 'value' => '初始化编辑器时的内容', 'editorOptions' => [ 'initialFrameWidth' => 1000, 'initialFrameHeight' => 500, ], ]);
编辑器相关配置,请在view中配置,参数为editorOptions,比如定制菜单,编辑器大小等等,具体参数请查看UeditorPlus官网文档
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-04