PHP code example of kail520 / ueditor

1. Go to this page and download the library: Download kail520/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/ */

    

kail520 / ueditor example snippets


use \kail520\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', '|'
            ],
        ]
]);

public function actions()
{
    return [
        'upload' => [
            'class' => 'kail520\ueditor\UEditorAction',
            'config' => [
                "imageUrlPrefix"  => "http://www.baidu.com",//图片访问路径前缀
                "imagePathFormat" => "/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}" //上传保存路径
                "imageRoot" => Yii::getAlias("@webroot"),
                 'is_oss' => true,
            ],
        ]
    ];
}

$ php composer.phar 

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

echo \kail520\\ueditor\UEditor::widget([]);

echo $form->field($model,'colum')->widget('kail520\ueditor\UEditor',[]);