Fix lightbox not showing iframe content

This commit is contained in:
Björn Fromme
2021-08-23 21:07:11 +02:00
parent 7e4de25580
commit 2b9486b1af
@@ -10,16 +10,14 @@ export default class extends Controller {
connect() {
let elements = []
if (this.hasUrlValue) {
let caption = this.getCaption(this.element)
let element = { href: this.urlValue, title: caption }
let element = { href: this.urlValue }
elements.push(element)
} else if (this.element.hasAttribute('href')) {
let caption = this.getCaption(this.element)
let element = { href: this.element.href, title: caption }
let element = { href: this.element.href }
elements.push(element)
} else {
this.thumbTargets.forEach(thumb => {
let caption = this.getCaption(thumb)
let caption = element.hasAttribute('data-lightbox-caption') ? element.dataset.lightboxCaption : null
elements.push({ href: thumb.href, title: caption })
})
}
@@ -36,8 +34,4 @@ export default class extends Controller {
}
this.lightbox.openAt(index - 1)
}
getCaption(element) {
return element.hasAttribute('data-lightbox-caption') ? element.dataset.lightboxCaption : null
}
}