Fix branding: live updates on save, reset clears everything, show defaults
- Clear inline preview styles before persisting CSS on save to avoid specificity conflicts that required Ctrl+Shift+R - Reset to Defaults now deletes uploaded images and clears logoText - ColorPicker emits value on Solid/Gradient toggle for instant preview - Show default color swatch with dashed border when field is cleared - persistThemeCSS now handles background-image rules like server-side Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -74,6 +74,21 @@ export function persistThemeCSS(theme: TenantThemeData) {
|
||||
if (theme.darkCardOpacity < 1) darkVars.push(` --card-backdrop-blur: blur(8px);`);
|
||||
}
|
||||
|
||||
// Handle background images
|
||||
const extraRules: string[] = [];
|
||||
if (theme.lightPageBgImage) {
|
||||
extraRules.push(`.layout-page-bg { background-image: url('${theme.lightPageBgImage}'); }`);
|
||||
}
|
||||
if (theme.lightNavBgImage) {
|
||||
extraRules.push(`.layout-nav-bg { background-image: url('${theme.lightNavBgImage}'); }`);
|
||||
}
|
||||
if (theme.darkPageBgImage) {
|
||||
extraRules.push(`html.dark .layout-page-bg { background-image: url('${theme.darkPageBgImage}'); }`);
|
||||
}
|
||||
if (theme.darkNavBgImage) {
|
||||
extraRules.push(`html.dark .layout-nav-bg { background-image: url('${theme.darkNavBgImage}'); }`);
|
||||
}
|
||||
|
||||
let css = '';
|
||||
if (lightVars.length > 0) {
|
||||
css += `:root {\n${lightVars.join('\n')}\n}\n`;
|
||||
@@ -81,6 +96,9 @@ export function persistThemeCSS(theme: TenantThemeData) {
|
||||
if (darkVars.length > 0) {
|
||||
css += `html.dark {\n${darkVars.join('\n')}\n}\n`;
|
||||
}
|
||||
if (extraRules.length > 0) {
|
||||
css += extraRules.join('\n') + '\n';
|
||||
}
|
||||
|
||||
// Find or create the <style id="tenant-theme"> element
|
||||
let styleEl = document.getElementById('tenant-theme') as HTMLStyleElement | null;
|
||||
|
||||
Reference in New Issue
Block a user