maclechan/yii2-ueditor

Yii2 Ueditor 百度编辑器

安装次数: 6

依赖关系: 0

建议者: 0

安全: 0

星标: 1

关注者: 2

分支: 0

开放问题: 0

语言:JavaScript

类型:yii2-extension

dev-master 2016-01-20 06:04 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:31:35 UTC


README

Yii2 Ueditor Yii2 - 百度编辑器

安装

通过 composer 安装此扩展是首选方法。

运行以下命令之一

composer require --prefer-dist maclechan/yii2-ueditor "*"

或者

"maclechan/yii2-ueditor": "*"

将以下内容添加到你的 composer.json 文件的 require 部分。

然后

'macle\\ueditor\\' => array($vendorDir . '/maclechan/yii2-ueditor'),

添加到你的 composer/autoload_psr4.php 文件的返回数组中

注意:在 vendor/maclechan/yii2-ueditor/ 下的所有文件

使用方法

安装扩展后,只需在代码中使用它即可

视图

<?php
use macle\ueditor\Ueditor;
echo UEditor::widget([
	'id'=>"Test[content]",
    'events' => [
        //编辑区域大小
        //'initialFrameHeight' => '4800',
        //设置语言
        'lang' =>'en', //中文为 zh-cn
        //定制菜单
        'toolbars' => [
            [
                'fullscreen', 'source', 'undo', 'redo', '|',
                'fontsize',
                'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat',
                'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|',
                'forecolor', 'backcolor', '|',
                'lineheight', '|',
                'indent', '|'
            ],
        ],
        
    ],
    'ucontent'=>$model->content,
]);

?>

or
<?= $form->field($model, 'content')->widget('macle\ueditor\Ueditor',['id'=>'Test[content]']); ?>
//在编辑时,显示默认值
<?= $form->field($model, 'content')->widget('macle\ueditor\Ueditor',['id'=>'Test[content]','ucontent'=>$model->content])->label(false); ?>

邮箱 maclechan@qq.com qq 429140141