zacksleo/yii2-ueditor

yii2 ueditor extend

Installs: 257

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 0

Open Issues: 0

Type:yii2-extension

v1.0.0 2017-02-23 11:20 UTC

This package is auto-updated.

Last update: 2024-11-08 07:23:19 UTC


README

Latest Stable Version Total Downloads License

Travis Build Status Code Climate Scrutinizer Scrutinizer Coverage

该插件根据135编辑器企业插件秀米编辑器Ueditor插件封装而来

用法

1. 在 config/main 中配置 module 为:

 'ueditor' => [
     'class' => 'zacksleo\yii2\ueditor\Module'
 ]
     

2. 在页面中使用

加载135编辑器插件:

use zacksleo\yii2\ueditor\assets\Editor135Asset;
Editor135Asset::register($this); 

$this->registerJsFile('/admin/ueditor/i25/script',[
    'depends'=>[
        'kucha\ueditor\UeditorAsset'
    ]
]);

echo \kucha\ueditor\UEditor::widget([
    'name' => 'ueditor',
    'clientOptions' => [
        //编辑区域大小
        'initialFrameHeight' => '200',
        //设置语言
        'lang' => 'zh-cn', //中文为 zh-cn
        'zIndex' => '9995',
        //定制菜单
        'toolbars' => [
            [
                'fullscreen', 'source', 'undo', 'redo', '|',
                'fontsize',
                'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat',
                'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|',
                'forecolor', 'backcolor', '|',
                'lineheight', '|',
                'indent', '|', '135editor'
            ],
        ]
    ]
]);

加载秀米编辑器插件:

use zacksleo\yii2\ueditor\assets\EditorXiumiAsset;
EditorXiumiAsset::register($this); 

$this->registerJsFile('/admin/ueditor/xiumi/script',[
    'depends'=>[
        'kucha\ueditor\UeditorAsset'
    ]
]);

echo \kucha\ueditor\UEditor::widget([
    'name' => 'ueditor',
    'clientOptions' => [
        //编辑区域大小
        'initialFrameHeight' => '200',
        //设置语言
        'lang' => 'zh-cn', //中文为 zh-cn
        'zIndex' => '9995',
        //定制菜单
        'toolbars' => [
            [
                'fullscreen', 'source', 'undo', 'redo', '|',
                'fontsize',
                'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat',
                'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|',
                'forecolor', 'backcolor', '|',
                'lineheight', '|',
                'indent', '|', '135editor'
            ],
        ]
    ]
]);

3. 更多关于 \kucha\ueditor\UEditor 的用法见文档