mirror of https://github.com/docusealco/docuseal
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
489 B
19 lines
489 B
export default class extends HTMLElement {
|
|
connectedCallback () {
|
|
const image = this.querySelector('img')
|
|
|
|
this.setAttribute('role', 'img')
|
|
|
|
if (image?.alt) {
|
|
this.setAttribute('aria-label', image.alt)
|
|
}
|
|
|
|
image.addEventListener('load', (e) => {
|
|
image.setAttribute('width', e.target.naturalWidth)
|
|
image.setAttribute('height', e.target.naturalHeight)
|
|
|
|
this.style.aspectRatio = `${e.target.naturalWidth} / ${e.target.naturalHeight}`
|
|
})
|
|
}
|
|
}
|