后台添加 richtext 组件,删除原 textarea 组件富文本判断
删除测试 FlatShipping 代码 删除多余参数
This commit is contained in:
parent
d35952fe5c
commit
5d4f0c99df
|
|
@ -19,6 +19,7 @@ use Beike\Admin\View\Components\Form\InputLocale;
|
|||
use Beike\Admin\View\Components\Form\Select;
|
||||
use Beike\Admin\View\Components\Form\SwitchRadio;
|
||||
use Beike\Admin\View\Components\Form\Textarea;
|
||||
use Beike\Admin\View\Components\Form\Richtext;
|
||||
use Beike\Admin\View\Components\Header;
|
||||
use Beike\Admin\View\Components\NoData;
|
||||
use Beike\Admin\View\Components\Sidebar;
|
||||
|
|
@ -139,6 +140,7 @@ class AdminServiceProvider extends ServiceProvider
|
|||
'form-select' => Select::class,
|
||||
'form-image' => Image::class,
|
||||
'form-textarea' => Textarea::class,
|
||||
'form-richtext' => Richtext::class,
|
||||
'no-data' => NoData::class,
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace Beike\Admin\View\Components\Form;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Richtext extends Component
|
||||
{
|
||||
public string $name;
|
||||
|
||||
public string $title;
|
||||
|
||||
public string $value;
|
||||
|
||||
public bool $required;
|
||||
|
||||
public function __construct(string $name, string $title, ?string $value, bool $required = false)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->title = $title;
|
||||
$this->value = $value;
|
||||
$this->required = $required;
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('admin::components.form.richtext');
|
||||
}
|
||||
}
|
||||
|
|
@ -14,15 +14,12 @@ class Textarea extends Component
|
|||
|
||||
public bool $required;
|
||||
|
||||
public bool $html;
|
||||
|
||||
public function __construct(string $name, string $title, ?string $value, bool $required = false, bool $html = false)
|
||||
public function __construct(string $name, string $title, ?string $value, bool $required = false)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->title = $title;
|
||||
$this->value = $value;
|
||||
$this->required = $required;
|
||||
$this->html = $html;
|
||||
}
|
||||
|
||||
public function render()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
@push('header')
|
||||
<script src="{{ asset('vendor/tinymce/5.9.1/tinymce.min.js') }}"></script>
|
||||
@endpush
|
||||
|
||||
<x-admin::form.row :title="$title" :required="$required">
|
||||
<div class="w-max-1000">
|
||||
<textarea rows="4" type="text" name="{{ $name }}" class="tinymce" placeholder="{{ $title }}">{{ $value }}</textarea>
|
||||
</div>
|
||||
{{ $slot }}
|
||||
</x-admin::form.row>
|
||||
|
|
@ -1,12 +1,6 @@
|
|||
@if (isset($html) && $html)
|
||||
@push('header')
|
||||
<script src="{{ asset('vendor/tinymce/5.9.1/tinymce.min.js') }}"></script>
|
||||
@endpush
|
||||
@endif
|
||||
|
||||
<x-admin::form.row :title="$title" :required="$required">
|
||||
<div class="{{ isset($html) && $html ? 'w-max-1000' : '' }}">
|
||||
<textarea rows="4" type="text" name="{{ $name }}" class="{{ isset($html) && $html ? 'tinymce' : 'form-control wp-400' }}" placeholder="{{ $title }}">{{ $value }}</textarea>
|
||||
<div>
|
||||
<textarea rows="4" type="text" name="{{ $name }}" class="form-control wp-400" placeholder="{{ $title }}">{{ $value }}</textarea>
|
||||
</div>
|
||||
{{ $slot }}
|
||||
</x-admin::form.row>
|
||||
|
|
|
|||
|
|
@ -52,13 +52,25 @@
|
|||
:name="$column['name']"
|
||||
:title="$column['label']"
|
||||
:required="$column['required'] ? true : false"
|
||||
:html="isset($column['html']) ? true : false"
|
||||
:value="old($column['name'], $column['value'] ?? '')">
|
||||
@if (isset($column['description']))
|
||||
<div class="help-text font-size-12 lh-base">{{ $column['description'] }}</div>
|
||||
@endif
|
||||
</x-admin-form-textarea>
|
||||
@endif
|
||||
|
||||
@if ($column['type'] == 'richtext')
|
||||
<x-admin-form-richtext
|
||||
:name="$column['name']"
|
||||
:title="$column['label']"
|
||||
:required="$column['required'] ? true : false"
|
||||
:value="old($column['name'], $column['value'] ?? '')">
|
||||
@if (isset($column['description']))
|
||||
<div class="help-text font-size-12 lh-base">{{ $column['description'] }}</div>
|
||||
@endif
|
||||
</x-admin-form-richtext>
|
||||
@endif
|
||||
|
||||
@endforeach
|
||||
|
||||
<x-admin::form.row title="">
|
||||
|
|
|
|||
Loading…
Reference in New Issue