|
|
@@ -91,9 +91,9 @@ export default {
|
|
91
|
91
|
if (!this.singlePost.galleries) return
|
|
92
|
92
|
const galleries = []
|
|
93
|
93
|
this.singlePost.galleries.forEach(gallery => {
|
|
94
|
|
- const withImages = {}
|
|
|
94
|
+ const withImages = []
|
|
95
|
95
|
gallery.ids.forEach(imageId => {
|
|
96
|
|
- withImages[imageId] = this.singlePost.attached[imageId]
|
|
|
96
|
+ withImages.push(this.singlePost.attached[imageId])
|
|
97
|
97
|
})
|
|
98
|
98
|
galleries.push(withImages)
|
|
99
|
99
|
})
|
|
|
@@ -102,9 +102,7 @@ export default {
|
|
102
|
102
|
activeGalleryImages() {
|
|
103
|
103
|
if (!this.singlePostGalleries || this.activeGalleryIndex < 0)
|
|
104
|
104
|
return []
|
|
105
|
|
- return Object.values(
|
|
106
|
|
- this.singlePostGalleries[this.activeGalleryIndex],
|
|
107
|
|
- )
|
|
|
105
|
+ return this.singlePostGalleries[this.activeGalleryIndex]
|
|
108
|
106
|
},
|
|
109
|
107
|
p2pPostsByType() {
|
|
110
|
108
|
return this.singlePost && this.singlePost.relatedto
|
|
|
@@ -198,16 +196,18 @@ export default {
|
|
198
|
196
|
},
|
|
199
|
197
|
async singlePost(post) {
|
|
200
|
198
|
console.log('---')
|
|
|
199
|
+ if (!this.$el) return
|
|
201
|
200
|
const content = this.$el.children[0].querySelector('section')
|
|
202
|
201
|
await nextTick()
|
|
203
|
202
|
const galleries = content.querySelectorAll('.wp-block-gallery')
|
|
204
|
203
|
const cb = e => {
|
|
205
|
204
|
this.activeGalleryIndex = parseInt(e.target.dataset.gallery)
|
|
206
|
|
- const galleryImages = Object.keys(
|
|
207
|
|
- this.singlePostGalleries[this.activeGalleryIndex],
|
|
208
|
|
- )
|
|
209
|
|
- this.activeImageIndex = parseInt(
|
|
210
|
|
- galleryImages.indexOf(e.target.dataset.id),
|
|
|
205
|
+ const galleryImages =
|
|
|
206
|
+ this.singlePost.galleries[this.activeGalleryIndex]
|
|
|
207
|
+ console.log(galleryImages)
|
|
|
208
|
+ if (!galleryImages.ids) return
|
|
|
209
|
+ this.activeImageIndex = galleryImages.ids.indexOf(
|
|
|
210
|
+ parseInt(e.target.dataset.id),
|
|
211
|
211
|
)
|
|
212
|
212
|
console.log(
|
|
213
|
213
|
`opening gallery: ${this.activeGalleryIndex}.${this.activeImageIndex}`,
|