From 5a68c8f6746c8c6bdd709d68a1d5683680671dd0 Mon Sep 17 00:00:00 2001 From: Dr Tracy Gardner Date: Thu, 5 Mar 2026 18:13:47 +0000 Subject: [PATCH] Preserve checkbox text styles during SVG export --- main/export.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/main/export.js b/main/export.js index db887dcd..3be6a2c6 100644 --- a/main/export.js +++ b/main/export.js @@ -275,13 +275,18 @@ async function generateSVG(block) { }); - const uiTexts = svgBlock.querySelectorAll( - "text.blocklyCheckbox, text.blocklyText", - ); + const uiTexts = svgBlock.querySelectorAll("text.blocklyText"); uiTexts.forEach((textElement) => { - textElement.setAttribute("style", "fill: #000000 !important;"); - textElement.setAttribute("stroke", "none"); - textElement.setAttribute("font-weight", "500"); + const isCheckbox = textElement.classList.contains("blocklyCheckbox"); + + textElement.style.fill = "#000000"; + + if (isCheckbox) { + return; + } + + textElement.style.stroke = "none"; + textElement.style.fontWeight = "500"; }); const fontBase64 = await convertFontToBase64(w500);