From 9374c028d4461512419c72243d254402efcd164a Mon Sep 17 00:00:00 2001 From: Shreshtha Sharma <145495563+Shreshthaaa@users.noreply.github.com> Date: Tue, 6 Aug 2024 22:05:35 +0530 Subject: [PATCH] feat: added block's style as a CSS class to block's root SVG (#8436) * fix: added block's style as a CSS class to block's root SVG * fix: added block's style as a CSS class to block's root SVG * fix: added block's style as a CSS class to block's root SVG --- core/block_svg.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/block_svg.ts b/core/block_svg.ts index acead527a..0da81f01d 100644 --- a/core/block_svg.ts +++ b/core/block_svg.ts @@ -1178,7 +1178,10 @@ export class BlockSvg .getRenderer() .getConstants() .getBlockStyle(blockStyleName); - this.styleName_ = blockStyleName; + + if (this.styleName_) { + dom.removeClass(this.svgGroup_, this.styleName_); + } if (blockStyle) { this.hat = blockStyle.hat; @@ -1188,6 +1191,9 @@ export class BlockSvg this.style = blockStyle; this.applyColour(); + + dom.addClass(this.svgGroup_, blockStyleName); + this.styleName_ = blockStyleName; } else { throw Error('Invalid style name: ' + blockStyleName); }