From f094a6a1aa1d9c8d1cc3a362c53d0c7b9b0c793a Mon Sep 17 00:00:00 2001 From: SethBurkart123 Date: Wed, 3 Apr 2024 17:35:45 +1100 Subject: [PATCH] fix live image variable renaming --- src/seqta/ui/Themes.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/seqta/ui/Themes.ts b/src/seqta/ui/Themes.ts index 3a485d48..1c06e1c4 100644 --- a/src/seqta/ui/Themes.ts +++ b/src/seqta/ui/Themes.ts @@ -118,6 +118,12 @@ export const UpdateThemePreview = async (updatedTheme: CustomThemeBase64 /* Omit if (existingImage && existingImage.variableName !== image.variableName) { // Remove the previous variableName from the document removeImageFromDocument(existingImage.variableName); + + // Update the variableName in imageData + imageData[image.id].variableName = image.variableName; + + // Update the variableName in the document + document.documentElement.style.setProperty('--' + image.variableName, `url(${existingImage.url})`); } if (image.url) { @@ -128,7 +134,7 @@ export const UpdateThemePreview = async (updatedTheme: CustomThemeBase64 /* Omit } imageData[image.id] = { - url: '', + url: imageData[image.id]?.url || '', variableName: image.variableName, }; });