rich-text multilingual
This commit is contained in:
parent
c3ce7bdcc1
commit
a329f280d9
|
|
@ -10,16 +10,25 @@ class RichText extends Component
|
||||||
|
|
||||||
public string $title;
|
public string $title;
|
||||||
|
|
||||||
public string $value;
|
public $value;
|
||||||
|
|
||||||
public bool $required;
|
public bool $required;
|
||||||
|
|
||||||
public function __construct(string $name, string $title, string $value = '', bool $required = false)
|
public bool $multiple;
|
||||||
|
|
||||||
|
public function __construct(string $name, string $title, $value = '', bool $required = false, bool $multiple = false)
|
||||||
{
|
{
|
||||||
|
$value = html_entity_decode($value, ENT_QUOTES);
|
||||||
|
|
||||||
|
if ($multiple) {
|
||||||
|
$value = json_decode($value, true);
|
||||||
|
}
|
||||||
|
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->title = $title;
|
$this->title = $title;
|
||||||
$this->value = html_entity_decode($value, ENT_QUOTES);
|
$this->value = $value;
|
||||||
$this->required = $required;
|
$this->required = $required;
|
||||||
|
$this->multiple = $multiple;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="swiper-pagination rectangle module-bs-product-{{ $module_id }}-pagination"></div>
|
<div class="swiper-pagination rectangle module-bs-product-{{ $module_id }}-pagination"></div>
|
||||||
<div class="swiper-button-prev product-bs-prev"></div>
|
<div class="swiper-button-prev product-bs-{{ $module_id }}-prev"></div>
|
||||||
<div class="swiper-button-next product-bs-next"></div>
|
<div class="swiper-button-next product-bs-{{ $module_id }}-next"></div>
|
||||||
@elseif (!$content['products'] and $design)
|
@elseif (!$content['products'] and $design)
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@for ($s = 0; $s < 4; $s++)
|
@for ($s = 0; $s < 4; $s++)
|
||||||
|
|
@ -59,8 +59,8 @@
|
||||||
|
|
||||||
// 如果需要前进后退按钮
|
// 如果需要前进后退按钮
|
||||||
navigation: {
|
navigation: {
|
||||||
nextEl: '.product-bs-next',
|
nextEl: '.product-bs-{{ $module_id }}-next',
|
||||||
prevEl: '.product-bs-prev',
|
prevEl: '.product-bs-{{ $module_id }}-prev',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,27 @@
|
||||||
@endpush
|
@endpush
|
||||||
|
|
||||||
<x-admin::form.row :title="$title" :required="$required">
|
<x-admin::form.row :title="$title" :required="$required">
|
||||||
<div class="w-max-1000">
|
@if ($multiple)
|
||||||
<textarea rows="4" type="text" name="{{ $name }}" class="tinymce" placeholder="{{ $title }}">{{ $value }}</textarea>
|
<ul class="nav nav-tabs w-max-1000 mb-3" id="myTab" role="tablist">
|
||||||
</div>
|
@foreach (locales() as $locale)
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link {{ $loop->first ? 'active' : ''}}" id="{{ $locale['code'] }}" data-bs-toggle="tab" data-bs-target="#{{ $locale['code'] }}-pane" type="button">{{ $locale['name'] }}</button>
|
||||||
|
</li>
|
||||||
|
@endforeach
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="tab-content w-max-1000" id="myTabContent">
|
||||||
|
@foreach (locales() as $locale)
|
||||||
|
<div class="tab-pane fade {{ $loop->first ? 'show active' : ''}}" id="{{ $locale['code'] }}-pane" role="tabpanel" aria-labelledby="{{ $locale['code'] }}">
|
||||||
|
<textarea rows="4" type="text" name="{{ $name }}[{{ $locale['code'] }}]" class="tinymce" placeholder="{{ $title }}">{{ $value[$locale['code']] }}</textarea>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<div class="w-max-1000">
|
||||||
|
<textarea rows="4" type="text" name="{{ $name }}" class="tinymce" placeholder="{{ $title }}">{{ $value }}</textarea>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
{{ $slot }}
|
{{ $slot }}
|
||||||
</x-admin::form.row>
|
</x-admin::form.row>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,10 @@
|
||||||
<x-admin-form-rich-text
|
<x-admin-form-rich-text
|
||||||
:name="$column['name']"
|
:name="$column['name']"
|
||||||
:title="$column['label']"
|
:title="$column['label']"
|
||||||
|
:value="old($column['name'], $column['value'] ?? '')"
|
||||||
:required="$column['required'] ? true : false"
|
:required="$column['required'] ? true : false"
|
||||||
:value="old($column['name'], $column['value'] ?? '')">
|
:multiple="$column['multiple']"
|
||||||
|
>
|
||||||
@if (isset($column['description']))
|
@if (isset($column['description']))
|
||||||
<div class="help-text font-size-12 lh-base">{{ $column['description'] }}</div>
|
<div class="help-text font-size-12 lh-base">{{ $column['description'] }}</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue