Fix lightbox not showing iframe content
This commit is contained in:
+3
-9
@@ -10,16 +10,14 @@ export default class extends Controller {
|
|||||||
connect() {
|
connect() {
|
||||||
let elements = []
|
let elements = []
|
||||||
if (this.hasUrlValue) {
|
if (this.hasUrlValue) {
|
||||||
let caption = this.getCaption(this.element)
|
let element = { href: this.urlValue }
|
||||||
let element = { href: this.urlValue, title: caption }
|
|
||||||
elements.push(element)
|
elements.push(element)
|
||||||
} else if (this.element.hasAttribute('href')) {
|
} else if (this.element.hasAttribute('href')) {
|
||||||
let caption = this.getCaption(this.element)
|
let element = { href: this.element.href }
|
||||||
let element = { href: this.element.href, title: caption }
|
|
||||||
elements.push(element)
|
elements.push(element)
|
||||||
} else {
|
} else {
|
||||||
this.thumbTargets.forEach(thumb => {
|
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 })
|
elements.push({ href: thumb.href, title: caption })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -36,8 +34,4 @@ export default class extends Controller {
|
|||||||
}
|
}
|
||||||
this.lightbox.openAt(index - 1)
|
this.lightbox.openAt(index - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
getCaption(element) {
|
|
||||||
return element.hasAttribute('data-lightbox-caption') ? element.dataset.lightboxCaption : null
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user