diff --git a/app/Helpers/Global/string_helper.php b/app/Helpers/Global/string_helper.php index 8ce8379..be6d0e7 100644 --- a/app/Helpers/Global/string_helper.php +++ b/app/Helpers/Global/string_helper.php @@ -2,6 +2,22 @@ use Illuminate\Support\Str; +if (! function_exists('str_first_sentence')) { +function str_first_sentence($str) { + // Split the string at ., !, or ? + $sentences = preg_split('/(\.|!|\?)(\s|$)/', $str, 2); + + // Return the first part of the array if available + if (isset($sentences[0])) { + return trim($sentences[0]); + } + + // If no sentence ending found, return the whole string + return $str; +} + +} + if (! function_exists('is_empty')) { /** * A better function to check if a value is empty or null. Strings, arrays, and Objects are supported. diff --git a/config/laravel_editorjs.php b/config/laravel_editorjs.php index b615970..874019e 100644 --- a/config/laravel_editorjs.php +++ b/config/laravel_editorjs.php @@ -16,21 +16,21 @@ ], 'level' => [1, 2, 3, 4, 5, 6], ], - 'list' => [ - 'type' => [ - 0 => 'ordered', - 1 => 'unordered', - ], - 'items' => [ - 'type' => 'array', - 'data' => [ - '-' => [ - 'type' => 'string', - 'allowedTags' => 'i,b,a[href],code[class],mark[class]', - ], - ], - ], +'list' => [ + 'style' => [ + 'type' => 'string', + 'allowedValues' => ['ordered', 'unordered'] + ], + 'items' => [ + 'type' => 'array', + 'data' => [ + '-' => [ + 'type' => 'string', + 'allowedTags' => 'i,b,a[href],code[class],mark[class]', ], + ], + ], +], 'linkTool' => [ 'link' => 'string', 'meta' => [ diff --git a/resources/views/front/partials/featured_post_card.blade.php b/resources/views/front/partials/featured_post_card.blade.php index 7fbf0a0..e7f19b5 100644 --- a/resources/views/front/partials/featured_post_card.blade.php +++ b/resources/views/front/partials/featured_post_card.blade.php @@ -30,7 +30,7 @@ class="text-decoration-none">{{ $post->title }} @else