mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Canvas: Fix canvas style regression (#87363)
This commit is contained in:
parent
1ef1cc7e3f
commit
5e4722fe2e
@ -2195,7 +2195,12 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use export all (\`export * from ...\`)", "3"]
|
||||
],
|
||||
"public/app/features/canvas/runtime/element.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "4"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "5"]
|
||||
],
|
||||
"public/app/features/canvas/runtime/frame.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
|
@ -191,16 +191,18 @@ export class ElementState implements LayerElement {
|
||||
this.sizeStyle = style;
|
||||
|
||||
if (this.div) {
|
||||
for (const [key, value] of Object.entries(this.sizeStyle)) {
|
||||
this.div.style.setProperty(key, value);
|
||||
for (const key in this.sizeStyle) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
this.div.style[key as any] = (this.sizeStyle as any)[key];
|
||||
}
|
||||
|
||||
// TODO: This is a hack, we should have a better way to handle this
|
||||
const elementType = this.options.type;
|
||||
if (!SVGElements.has(elementType)) {
|
||||
// apply styles to div if it's not an SVG element
|
||||
for (const [key, value] of Object.entries(this.dataStyle)) {
|
||||
this.div.style.setProperty(key, value);
|
||||
for (const key in this.dataStyle) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
this.div.style[key as any] = (this.dataStyle as any)[key];
|
||||
}
|
||||
} else {
|
||||
// ELEMENT IS SVG
|
||||
@ -209,7 +211,8 @@ export class ElementState implements LayerElement {
|
||||
// wrapper div element (this.div) doesn't re-render (has static `key` property),
|
||||
// so we have to clean styles manually;
|
||||
for (const key in this.dataStyle) {
|
||||
this.div.style.removeProperty(key);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
this.div.style[key as any] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user