Fix lightbox not showing iframe content
This commit is contained in:
+3
-9
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user