lxpgw/yii2-ueditor-widget
Composer 安装命令:
composer require lxpgw/yii2-ueditor-widget
包简介
yii2-ueditor-widget
README 文档
README
composer.json
"require": { "xj/yii2-ueditor-widget": "*" },
example:
<?php //外部TAG echo \xj\ueditor\Html::tag('script', $model->username, [ 'id' => Html::getInputId($model, 'username'), 'name' => Html::getInputName($model, 'username'), 'type' => 'text/plain', ]); echo Ueditor::widget([ 'model' => $model, 'attribute' => 'username', 'renderTag' => false, 'jsOptions' => [ 'serverUrl' => common\helpers\Url::to(['upload']), 'autoHeightEnable' => true, 'autoFloatEnable' => true ], ]); ?> <?php //Widget直接渲染Tag echo \xj\ueditor\Ueditor::widget([ 'model' => $model, 'attribute' => 'password', 'name' => 'customName', 'value' => 'content', 'style' => 'width:100%;height:400px', 'renderTag' => true, 'readyEvent' => 'console.log("example2 ready")', 'jsOptions' => [ 'serverUrl' => yii\helpers\Url::to(['upload']), 'autoHeightEnable' => true, 'autoFloatEnable' => true ], ]); ?>
Action:
public function actions() { return [ 'upload' => [ 'class' => \xj\ueditor\actions\Upload::className(), 'uploadBasePath' => '@webroot', //file system path 'uploadBaseUrl' => '@web', //web path 'csrf' => true, //csrf校验 'configPatch' => [ 'imageMaxSize' => 500 * 1024, //图片 'scrawlMaxSize' => 500 * 1024, //涂鸦 'catcherMaxSize' => 500 * 1024, //远程 'videoMaxSize' => 1024 * 1024, //视频 'fileMaxSize' => 1024 * 1024, //文件 'imageManagerListPath' => '/', //图片列表 'fileManagerListPath' => '/', //文件列表 ], // OR Closure 'pathFormat' => [ 'imagePathFormat' => 'image/{yyyy}{mm}{dd}/{time}{rand:6}', 'scrawlPathFormat' => 'image/{yyyy}{mm}{dd}/{time}{rand:6}', 'snapscreenPathFormat' => 'image/{yyyy}{mm}{dd}/{time}{rand:6}', 'snapscreenPathFormat' => 'image/{yyyy}{mm}{dd}/{time}{rand:6}', 'catcherPathFormat' => 'image/{yyyy}{mm}{dd}/{time}{rand:6}', 'videoPathFormat' => 'video/{yyyy}{mm}{dd}/{time}{rand:6}', 'filePathFormat' => 'file/{yyyy}{mm}{dd}/{time}{rand:6}', ], // For Closure 'pathFormat' => [ 'imagePathFormat' => [$this, 'format'], 'scrawlPathFormat' => [$this, 'format'], 'snapscreenPathFormat' => [$this, 'format'], 'snapscreenPathFormat' => [$this, 'format'], 'catcherPathFormat' => [$this, 'format'], 'videoPathFormat' => [$this, 'format'], 'filePathFormat' => [$this, 'format'], ], 'beforeUpload' => function($action) { // throw new \yii\base\Exception('error message'); //break }, 'afterUpload' => function($action) { /*@var $action \xj\ueditor\actions\Upload */ var_dump($action->result); // 'state' => string 'SUCCESS' (length=7) // 'url' => string '/attachment/201109/1425310269294251.jpg' (length=61) // 'relativePath' => string '201109/1425310269294251.jpg' () // 'title' => string '1425310269294251.jpg' (length=20) // 'original' => string 'Chrysanthemum.jpg' (length=17) // 'type' => string '.jpg' (length=4) // 'size' => int 879394 throw new \yii\base\Exception('error message'); //break }, ], ]; } // for Closure Format public function format(\xj\ueditor\actions\Uploader $action) { $fileext = $action->fileType; $filehash = sha1(uniqid() . time()); $p1 = substr($filehash, 0, 2); $p2 = substr($filehash, 2, 2); return "{$p1}/{$p2}/{$filehash}.{$fileext}"; }
lxpgw/yii2-ueditor-widget 适用场景与选型建议
lxpgw/yii2-ueditor-widget 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 12 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 lxpgw/yii2-ueditor-widget 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lxpgw/yii2-ueditor-widget 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-12-01