@props([
'name' => 'content',
'label' => 'Contenu',
'value' => '',
'preset' => 'full', // 'minimal', 'text', 'full', 'custom'
'plugins' => null,
'toolbar' => null,
'rows' => 10, {{-- Valeur par défaut --}}
'height' => 400, {{-- Valeur TinyMCE --}}
'allowImages' => false,
'id' => 'tiny-'.random_int(100000, 999999),
'required' => false,
'showlabel' => "true",
])
@php
// Définir les presets
$presets = [
'minimal' => [
'plugins' => 'code',
'toolbar' => 'bold italic underline | code',
'allowImages' => false,
],
'text' => [
'plugins' => 'lists link code',
'toolbar' => 'undo redo | blocks | bold italic underline | alignleft aligncenter alignright alignjustify | link code',
'allowImages' => false,
],
'standard' => [
'plugins' => 'lists link table code',
'toolbar' => 'undo redo | blocks | bold italic underline | alignleft aligncenter alignright | bullist numlist | link table code',
'allowImages' => false,
],
'full' => [
'plugins' => 'image link lists code table media',
'toolbar' => 'undo redo | blocks | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist | image link media table | code',
'allowImages' => true,
],
'blog' => [
'plugins' => 'image link lists code table media anchor',
'toolbar' => 'undo redo | blocks | bold italic | alignleft aligncenter alignright | bullist numlist | link image media | code',
'allowImages' => true,
],
];
// Récupérer les options selon le preset ou utiliser les props personnalisées
if ($preset === 'custom') {
$currentPlugins = $plugins ?? $presets['full']['plugins'];
$currentToolbar = $toolbar ?? $presets['full']['toolbar'];
$currentAllowImages = $allowImages;
} else {
$presetConfig = $presets[$preset] ?? $presets['full'];
$currentPlugins = $plugins ?? $presetConfig['plugins'];
$currentToolbar = $toolbar ?? $presetConfig['toolbar'];
$currentAllowImages = $allowImages && $presetConfig['allowImages'];
}
@endphp
@if($showlabel == "true")
@endif
@push('script')
@endpush