|
|
@@ -4,7 +4,7 @@
|
|
4
|
4
|
article.f-grow.shadow
|
|
5
|
5
|
header
|
|
6
|
6
|
h1 {{ type }}:{{ $route.params.slug }} single
|
|
7
|
|
- button(v-if="images.length > 0" @click="fullscreengallery = true") fullscreen
|
|
|
7
|
+ button(@click="fullscreengallery = true") fullscreen
|
|
8
|
8
|
section(v-if="posts[$route.params.slug]")
|
|
9
|
9
|
h4 {{ posts[$route.params.slug].title }}
|
|
10
|
10
|
.block-wrapper(v-for="block in posts[$route.params.slug].blocks" v-html="block")
|
|
|
@@ -70,23 +70,24 @@ export default {
|
|
70
|
70
|
})
|
|
71
|
71
|
allBlocks.forEach(block => {
|
|
72
|
72
|
if(!block) return
|
|
73
|
|
-
|
|
74
|
|
- const domparser = new DOMParser()
|
|
75
|
|
- const doc = domparser.parseFromString(block, 'text/html')
|
|
76
|
|
-
|
|
|
73
|
+ const doc = new DOMParser().parseFromString(block, 'text/html')
|
|
77
|
74
|
const gallery = doc.querySelectorAll('.blocks-gallery-item img')
|
|
78
|
75
|
if(gallery) {
|
|
79
|
|
- this.images = [].slice.call(gallery).map(item => { return item.src })
|
|
|
76
|
+ this.images = [].slice.call(gallery).map(item => {
|
|
|
77
|
+ return item.src }
|
|
|
78
|
+ )
|
|
80
|
79
|
}
|
|
81
|
80
|
})
|
|
82
|
81
|
}
|
|
83
|
82
|
},
|
|
84
|
83
|
watch: {
|
|
85
|
|
- posts(newVal, oldVal) {
|
|
|
84
|
+ posts(newVal, oldVal) {
|
|
|
85
|
+ // Loads images from the DOM
|
|
86
|
86
|
this.checkForImages(newVal)
|
|
87
|
87
|
}
|
|
88
|
88
|
},
|
|
89
|
89
|
mounted() {
|
|
|
90
|
+ // Only makes req if this hasn't been loaded yet
|
|
90
|
91
|
if(!this.posts[this.$route.params.slug]) {
|
|
91
|
92
|
let type = this.$route.params.type
|
|
92
|
93
|
type = type.charAt(0).toUpperCase() + type.slice(1)
|