njxqlus / filament-lightbox

Lightbox entry for Filament
MIT License
15 stars 7 forks source link

Not working in modal infolist #7

Open aliaswpeu opened 8 months ago

aliaswpeu commented 8 months ago

What happened?

When i have a table action with infolist as modal action, the ligtbox is not opening, when i click image it shows image without lightbox. `->actions([ \Filament\Tables\Actions\Action::make('View Information')

                ->infolist([

                    Section::make('Personal Information')
                        ->schema([
                            TextEntry::make('name'),
                        ])
                        ->columns(),

                    LightboxSpatieMediaLibraryImageEntry::make('foo')
                        ->collection('vehicle-images')
                        ->conversion('web')
                        ->circular()
                        ->label('Pics')
                ]),

`

How to reproduce the bug

Click on image

Package Version

latest

PHP Version

8.2

Laravel Version

latest

Filament Version

latest

Notes

No response

njxqlus commented 8 months ago

Please, provide full code example

tenroaji commented 7 months ago

i have same issue,

i try to show example : LightboxImageEntry::make('foo') ->image('https://biati-digital.github.io/glightbox/demo/img/small/gm2.jpg') ->href('https://biati-digital.github.io/glightbox/demo/img/large/gm2.jpg');

just show like this

image

njxqlus commented 6 months ago

LightboxImageEntry::make('foo')

@tenroaji are you sure that you have the foo field in your model? You must use this entry on existing field, for example, try id

mariusmow commented 5 months ago

I am experiencing the exact same issue. Created a modal action, which load a custom view. The view contains a livewire component. The image displays in the modal, but as soon as I click on it, the image open browser tab and not with lightbox.

It is like lightbox is not initializing on a modal.

image

mariusmow commented 5 months ago

I found a solution, not sure its an ideal solution but it works.

Seems like the newly added items to the DOM is not seen by the JS. So I have added this to my blade and it works.

@script
    <script type="module">
        Livewire.hook('morph.added', (element) => {
            const lightbox = GLightbox(@json(config('filament-lightbox')));
        });
    </script>
@endscript
tenroaji commented 4 months ago

LightboxImageEntry::make('foo')

@tenroaji are you sure that you have the foo field in your model? You must use this entry on existing field, for example, try id

sorry, this is my mistake, after I tried with the existing field it was already working, thank you