laravel-ueditor富文本编辑器

来源:互联网 发布:java检测图片木马 编辑:程序博客网 时间:2024/05/17 03:15
1.composer.json里加入
"overtrue/laravel-ueditor": "~1.0",


2.然后composer update 更新


3.app.php添加
Overtrue\LaravelUEditor\UEditorServiceProvider::class,


4.运行命令:php artisan config:publish    生成配置文件




5.在filesystems.php文件里配置public项
'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'url' => env('APP_URL').'/object/storage/app/public',
            'visibility' => 'public',
        ],


6.模板文件中使用



模板中引用: @include('vendor.ueditor.assets')


然后添加编辑器的地方加入
    <!-- 实例化编辑器 -->
                                <script type="text/javascript">
                                    var ue = UE.getEditor('container');
                                    ue.ready(function() {
                                        ue.execCommand('serverparam', '_token', '{{ csrf_token() }}'); // 设置 CSRF token.
                                    });
                                </script>


                                <!-- 编辑器容器 -->
                                <script id="container" name="content" type="text/plain" style="height:250px;"></script>