1. 程式人生 > >laravel-admin ueditor 整合並解決重新整理問題

laravel-admin ueditor 整合並解決重新整理問題


laravel-admin 是一個快速開發管理後臺的框架,這裡不做詳細介紹

UEditor.php

<?php
namespace App\Extensions;
use Encore\Admin\Form\Field;
class UEditor extends Field
{
    protected static $css = [
    ];
    public static $isJs=false;
    protected static $js = [
        '/laravel-u-editor/ueditor.config.js',
        '/laravel-u-editor/ueditor.all.min.js',
        '/laravel-u-editor/lang/zh-cn/zh-cn.js',
    ];
    protected $view = 'Admin.Tool.UEditor';
    public function render()
    {
        $this->script = <<<EOT
        UE.delEditor('{$this->id}');
             var  ue = UE.getEditor('{$this->id}');
EOT;
        return parent::render();
    }
}


 UEditor.blade.php

<div class="form-group {!! !$errors->has($errorKey) ?: 'has-error' !!}">
    <label for="{{$id}}" class="col-sm-2 control-label">{{$label}}</label>
    <div class="col-sm-8">
        @include('admin::form.error')
        <textarea class="{{ $class }}" id="{{$name}}" name="{{$name}}" placeholder="{{ $placeholder }}" {!! $attributes !!} >{{ old($column, $value) }}</textarea>
        @include('admin::form.help-block')
    </div>
</div>