PHP code example of mayunfeng / yii2-ueditor

1. Go to this page and download the library: Download mayunfeng/yii2-ueditor library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mayunfeng / yii2-ueditor example snippets

bash
public function actions()
{
    return [
        'upload' => [
            'class' => 'yii2\ueditor\UEditorAction',
        ]
    ];
}
bash
echo \yii2\ueditor\UEditor::widget(['name' => 'xxxx']);
bash
echo $form->field($model,'colum')->widget('yii2\ueditor\UEditor',[]);
bash
use \yii2\ueditor\UEditor;
echo UEditor::widget([
    'clientOptions' => [
        //编辑区域大小
        'initialFrameHeight' => '200',
        //设置语言
        'lang' =>'en', //中文为 zh-cn
        //定制菜单
        'toolbars' => [
            [
                'fullscreen', 'source', 'undo', 'redo', '|',
                'fontsize',
                'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat',
                'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|',
                'forecolor', 'backcolor', '|',
                'lineheight', '|',
                'indent', '|'
            ],
        ]
]);
bash
public function actions()
{
    return [
        'upload' => [
            'class' => 'kucha\ueditor\UEditorAction',
            'config' => [
                "imageUrlPrefix"  => "http://www.baidu.com",//图片访问路径前缀
                "imagePathFormat" => "/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}" //上传保存路径
                "imageRoot" => Yii::getAlias("@webroot"),
                "disk" => "oss" // 需要上传至阿里云oss,填写此项。否则会上传至本地
            ],
        ]
    ];
}