truncate html created only truncated text

This commit is contained in:
Burak Civan
2022-10-17 18:24:44 +03:00
parent d9218eff7f
commit f5f69139d5
2 changed files with 15 additions and 6 deletions

View File

@ -1,8 +1,21 @@
@php
$slot_text_length = strlen($slot);
$slot_isHtml = strlen(strip_tags($slot)) < strlen($slot);
@endphp
@if ($slot_text_length >= '30' && ! $slot_isHtml)
<div data-truncate-parent class="flex lg:block truncate">
<div
@class([ $width ])
@class([
$width,
'truncate',
])
data-truncate
>
{!! $slot !!}
</div>
</div>
</div>
@else
{!! $slot !!}
@endif