diff --git a/resources/views/components/ui/filelist.blade.php b/resources/views/components/ui/filelist.blade.php index 77b5dbe..ec6fe71 100644 --- a/resources/views/components/ui/filelist.blade.php +++ b/resources/views/components/ui/filelist.blade.php @@ -49,16 +49,22 @@ function updateFiles(result) { Alpine.store('files', []); - result = result.filter((item) => item.length > 0); + // Check if result is a string or a collection + if (typeof result === 'string') { + result = result.split(',').filter((item) => item.length > 0); - Promise.all(result.map(fileName => new Promise(resolve => { - SM.mediaDetails(fileName, (details) => { - details.extension = fileName.split('.').pop(); - resolve(details); + Promise.all(result.map(fileName => new Promise(resolve => { + SM.mediaDetails(fileName, (details) => { + resolve(details); + }); + }))).then(detailsArray => { + Alpine.store('files', detailsArray); }); - }))).then(detailsArray => { - Alpine.store('files', detailsArray); - }); + + } else if (Array.isArray(result)) { + // If result is a collection, directly place it in the store + Alpine.store('files', result); + } const elem = document.getElementById('{{ $name }}'); if(elem) { diff --git a/resources/views/post/show.blade.php b/resources/views/post/show.blade.php index 25036d1..a517184 100644 --- a/resources/views/post/show.blade.php +++ b/resources/views/post/show.blade.php @@ -10,6 +10,6 @@
{!! $post->content !!}
- +