fix(gallery): check also that PhotoSwipeUI_Default is loaded

This commit is contained in:
Jimmy Cai 2020-12-22 19:16:09 +01:00
parent 9acba47e08
commit 619998b2f3
No known key found for this signature in database
GPG Key ID: 3EA408E527F37B18

View File

@ -21,11 +21,11 @@ class StackGallery {
private items: PhotoSwipeItem[] = []; private items: PhotoSwipeItem[] = [];
constructor(container: HTMLElement, galleryUID = 1) { constructor(container: HTMLElement, galleryUID = 1) {
if (window.PhotoSwipe == undefined) { if (window.PhotoSwipe == undefined || window.PhotoSwipeUI_Default == undefined) {
console.error("PhotoSwipe lib not loaded."); console.error("PhotoSwipe lib not loaded.");
return; return;
} }
this.galleryUID = galleryUID; this.galleryUID = galleryUID;
StackGallery.createGallery(container); StackGallery.createGallery(container);