mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 07:44:35 +02:00
fixed errors VC
This commit is contained in:
parent
5ec8c68aed
commit
06a3318fb6
@ -73,30 +73,20 @@ export default class BarsGraph extends Item<BarsGraphProps> {
|
|||||||
protected createDomElement(): HTMLElement {
|
protected createDomElement(): HTMLElement {
|
||||||
const element = document.createElement("div");
|
const element = document.createElement("div");
|
||||||
element.className = "bars-graph";
|
element.className = "bars-graph";
|
||||||
element.innerHTML = this.props.html;
|
element.style.backgroundImage = `url(${this.props.html})`;
|
||||||
|
element.style.backgroundRepeat = "no-repeat";
|
||||||
// Hack to execute the JS after the HTML is added to the DOM.
|
element.style.backgroundSize = `${this.props.width}px ${
|
||||||
const scripts = element.getElementsByTagName("script");
|
this.props.height
|
||||||
for (let i = 0; i < scripts.length; i++) {
|
}px`;
|
||||||
setTimeout(() => {
|
|
||||||
if (scripts[i].src.length === 0) eval(scripts[i].innerHTML.trim());
|
|
||||||
}, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected updateDomElement(element: HTMLElement): void {
|
protected updateDomElement(element: HTMLElement): void {
|
||||||
element.innerHTML = this.props.html;
|
element.style.backgroundImage = `url(${this.props.html})`;
|
||||||
|
element.style.backgroundRepeat = "no-repeat";
|
||||||
// Hack to execute the JS after the HTML is added to the DOM.
|
element.style.backgroundSize = `${this.props.width}px ${
|
||||||
const aux = document.createElement("div");
|
this.props.height
|
||||||
aux.innerHTML = this.props.html;
|
}px`;
|
||||||
const scripts = aux.getElementsByTagName("script");
|
|
||||||
for (let i = 0; i < scripts.length; i++) {
|
|
||||||
if (scripts[i].src.length === 0) {
|
|
||||||
eval(scripts[i].innerHTML.trim());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user