yidashi/yii2-ueditor

This package is abandoned and no longer maintained. No replacement package was suggested.

desc

Installs: 591

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Language:JavaScript

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

Either run

$ php composer.phar require yidashi/yii2-ueditor "*"

or add

"yidashi/yii2-ueditor": "*"

to the require section of your composer.json file.

应用

controller:

public function actions()
{
    return [
        'upload' => [
            'class' => 'kucha\ueditor\UEditorAction',
        ]
    ];
}

view:

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}" //上传保存路径
            ],
        ]
    ];
}