Regression: Photoswipe not working (#19569)

pull/19571/head^2
Martin Schoeler 5 years ago committed by GitHub
parent 304852b076
commit 07e91699c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      app/ui/client/views/app/photoswipe.html
  2. 9
      app/ui/client/views/app/photoswipe.js

@ -1,4 +1,6 @@
<template name="photoswipe">
<template name="photoswipe"></template>
<template name="photoswipeContent">
<div class="pswp" id="pswp" tabindex="-1" role="dialog" aria-hidden="true">
<div class="pswp__bg"></div>
<div class="pswp__scroll-wrap">
@ -34,4 +36,4 @@
</div>
</div>
</div>
</template>
</template>

@ -1,12 +1,17 @@
import { Meteor } from 'meteor/meteor';
import { Blaze } from 'meteor/blaze';
import { Template } from 'meteor/templating';
import s from 'underscore.string';
Meteor.startup(() => {
let currentGallery = null;
const initGallery = async (items, options) => {
const [PhotoSwipe, PhotoSwipeUI_Default] = await Promise.all([import('photoswipe'), import('photoswipe/dist/photoswipe-ui-default'), import('photoswipe/dist/photoswipe.css')]);
Blaze.render(Template.photoswipeContent, document.body);
const [PhotoSwipeImport, PhotoSwipeUI_DefaultImport] = await Promise.all([import('photoswipe'), import('photoswipe/dist/photoswipe-ui-default'), import('photoswipe/dist/photoswipe.css'), import('./photoswipe-content.html')]);
if (!currentGallery) {
currentGallery = new PhotoSwipe(document.getElementById('pswp'), PhotoSwipeUI_Default, items, options);
const PhotoSwipe = PhotoSwipeImport.default;
const PhotoSwipeUI_Default = PhotoSwipeUI_DefaultImport.default;
currentGallery = await new PhotoSwipe(document.getElementById('pswp'), PhotoSwipeUI_Default, items, options);
currentGallery.listen('destroy', () => {
currentGallery = null;
});

Loading…
Cancel
Save