mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-24 20:01:36 +02:00
Fix src could not be changed after being set
This commit is contained in:
parent
ac52723ce7
commit
0963f7d548
@ -26,6 +26,7 @@ export class Et2Image extends Et2Widget(SlotMixin(LitElement)) implements et2_ID
|
|||||||
::slotted(img) {
|
::slotted(img) {
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
:host([icon]) {
|
:host([icon]) {
|
||||||
height: 1.3rem;
|
height: 1.3rem;
|
||||||
@ -120,6 +121,7 @@ export class Et2Image extends Et2Widget(SlotMixin(LitElement)) implements et2_ID
|
|||||||
<img ${this.id ? html`id="${this.id}"` : ''}
|
<img ${this.id ? html`id="${this.id}"` : ''}
|
||||||
src="${src}"
|
src="${src}"
|
||||||
alt="${this.label}"
|
alt="${this.label}"
|
||||||
|
part="image"
|
||||||
title="${this.statustext || this.label}"
|
title="${this.statustext || this.label}"
|
||||||
>`;
|
>`;
|
||||||
}
|
}
|
||||||
@ -130,7 +132,6 @@ export class Et2Image extends Et2Widget(SlotMixin(LitElement)) implements et2_ID
|
|||||||
<slot></slot>`;
|
<slot></slot>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected parse_href(img_href : string) : string
|
protected parse_href(img_href : string) : string
|
||||||
{
|
{
|
||||||
// allow url's too
|
// allow url's too
|
||||||
@ -160,7 +161,7 @@ export class Et2Image extends Et2Widget(SlotMixin(LitElement)) implements et2_ID
|
|||||||
|
|
||||||
get _img()
|
get _img()
|
||||||
{
|
{
|
||||||
return this.__getDirectSlotChild('img');
|
return this.querySelector('img');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -171,6 +172,10 @@ export class Et2Image extends Et2Widget(SlotMixin(LitElement)) implements et2_ID
|
|||||||
{
|
{
|
||||||
super.updated(changedProperties);
|
super.updated(changedProperties);
|
||||||
|
|
||||||
|
if(changedProperties.has("src"))
|
||||||
|
{
|
||||||
|
this._img.setAttribute("src", this.parse_href(this.src) || this.parse_href(this.default_src));
|
||||||
|
}
|
||||||
// if there's an href or onclick, make it look clickable
|
// if there's an href or onclick, make it look clickable
|
||||||
if(changedProperties.has("href") || changedProperties.has("onclick"))
|
if(changedProperties.has("href") || changedProperties.has("onclick"))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user