{{-- An editable text zone. Charity Appraisal The slot is the design default and stays the source of truth until an admin overrides the zone in the customizer (Content → Customizer). Copy and whitelisted typography then come from `site_texts`; deleting the row reverts to the slot. `data-editable` is what the customizer's element picker matches on, so a zone that is not wrapped in this component simply is not editable — that is the intended way to keep structural copy out of the client's hands. --}} @props([ 'key', 'as' => 'span', 'label' => null, 'html' => false, ]) @php $texts = app(\App\Services\SiteTexts::class); $zone = $texts->get($key); // Whitelisted: `as` is interpolated straight into the tag name, so a typo // (or a value built from user input) must not be able to emit markup. $tag = in_array($as, ['span', 'div', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'li', 'strong', 'small', 'label'], true) ? $as : 'span'; // The caller's own inline style stays first so a zone override wins. $styleAttr = implode(';', array_filter([ trim((string) $attributes->get('style'), '; '), $texts->inlineStyle($zone['styles']), ])); $override = $zone['content']; // The markers are emitted for every visitor, not only inside the // customizer. Rendering them conditionally on Customizer::isActive() looks // like free bytes, but a Livewire update is its own POST to // /livewire/update and carries no `?customizer=1` — so the zones vanish // from the preview the moment the client sorts, switches lens or expands a // row, and the picker is left with nothing to pick. @endphp <{{ $tag }} {{ $attributes->except('style')->merge($styleAttr !== '' ? ['style' => $styleAttr] : []) }} data-editable="{{ $key }}" @if ($label) data-editable-label="{{ $label }}" @endif @if ($html) data-editable-html="1" @endif >@if ($override !== null){!! $html ? $override : e($override) !!}@else{{ $slot }}@endif