wrap link icon
This commit is contained in:
parent
370ce0cefe
commit
c91b284d70
1 changed files with 8 additions and 4 deletions
|
@ -63,18 +63,22 @@ export class LinkEmbed extends HTMLElement {
|
||||||
}
|
}
|
||||||
this.append(_link)
|
this.append(_link)
|
||||||
|
|
||||||
|
const _iconWrapper = ownerDocument.createElement('div')
|
||||||
|
_iconWrapper.classList.add('icon-wrapper')
|
||||||
|
_link.append(_iconWrapper)
|
||||||
|
|
||||||
const _icon = ownerDocument.createElement('img')
|
const _icon = ownerDocument.createElement('img')
|
||||||
_link.append(_icon)
|
|
||||||
_icon.alt = '' // decorative
|
_icon.alt = '' // decorative
|
||||||
_icon.classList.add('no-inflate')
|
_icon.classList.add('no-inflate')
|
||||||
|
_iconWrapper.append(_icon)
|
||||||
this._observers.icon = {
|
this._observers.icon = {
|
||||||
element: _icon,
|
element: _icon,
|
||||||
observer: (oldVal, newVal) => {
|
observer: (oldVal, newVal) => {
|
||||||
const { element } = this._observers.icon
|
|
||||||
if (!!newVal) {
|
if (!!newVal) {
|
||||||
element!.setAttribute('src', newVal)
|
_icon.setAttribute('src', newVal)
|
||||||
|
_iconWrapper.style.display = 'inherit'
|
||||||
} else {
|
} else {
|
||||||
element!.style.display = 'hidden'
|
_iconWrapper.style.display = 'hidden'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue