yidashi / yii2-ueditor
该软件包已被废弃,不再维护。未建议替代软件包。
描述
v1.0.1
2016-07-01 09:09 UTC
This package is not auto-updated.
Last update: 2016-12-11 09:19:18 UTC
README
安装
抄裤衩的,修复一个不算bug的bug
运行以下命令之一:
$ php composer.phar require yidashi/yii2-ueditor "*"
或者添加以下内容到你的 composer.json
文件的 require
部分。
"yidashi/yii2-ueditor": "*"
到
应用
控制器
public function actions()
{
return [
'upload' => [
'class' => 'kucha\ueditor\UEditorAction',
]
];
}
视图
echo \kucha\ueditor\UEditor::widget([]);
或者:
echo $form->field($model,'colum')->widget('kucha\ueditor\UEditor',[]);
配置相关
编辑器相关配置,请在view
中配置,参数为clientOptions
,比如定制菜单,编辑器大小等等,具体参数请查看UEditor官网文档。
简单示例
use \kucha\ueditor\UEditor; echo UEditor::widget([ 'clientOptions' => [ //编辑区域大小 'initialFrameHeight' => '200', //定制菜单 'toolbars' => [ [ 'fullscreen', 'source', 'undo', 'redo', '|', 'fontsize', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', '|', 'lineheight', '|', 'indent', '|' ], ] ]);
文件上传相关配置,请在controller
中配置,参数为config
,例如文件上传路径等;更多参数请参照 config.php (与UEditor提供的config.json一样)
简单示例
public function actions() { return [ 'upload' => [ 'class' => 'kucha\ueditor\UEditorAction', 'config' => [ "imageUrlPrefix" => "http://www.baidu.com/",//图片访问路径前缀 "imageRootPath" => "/static/",//上传保存根路径 "imagePathFormat" => "upload/image/{yyyy}{mm}{dd}/{time}{rand:6}" //上传保存路径 ], ] ]; }