diff --git a/manifest.json b/manifest.json index 608de1f..a4bc22e 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-style-settings", "name": "Style Settings", - "version": "1.0.5", + "version": "1.0.6", "minAppVersion": "0.11.5", "description": "Offers controls for adjusting theme, plugin, and snippet CSS variables.", "author": "mgmeyers", diff --git a/src/SettingsManager.ts b/src/SettingsManager.ts index 904af62..e175607 100644 --- a/src/SettingsManager.ts +++ b/src/SettingsManager.ts @@ -470,26 +470,28 @@ export class CSSSettingsManager { ); this.styleTag.innerText = ` - body.css-settings-manager { - ${vars.reduce((combined, current) => { - return combined + `--${current.key}: ${current.value}; `; - }, '')} - } - - body.theme-light.css-settings-manager { - ${themedLight.reduce((combined, current) => { - return combined + `--${current.key}: ${current.value}; `; - }, '')} - } - - body.theme-dark.css-settings-manager { - ${themedDark.reduce((combined, current) => { - return combined + `--${current.key}: ${current.value}; `; - }, '')} - } - ` + body.css-settings-manager { + ${vars.reduce((combined, current) => { + return combined + `--${current.key}: ${current.value}; `; + }, '')} + } + + body.theme-light.css-settings-manager { + ${themedLight.reduce((combined, current) => { + return combined + `--${current.key}: ${current.value}; `; + }, '')} + } + + body.theme-dark.css-settings-manager { + ${themedDark.reduce((combined, current) => { + return combined + `--${current.key}: ${current.value}; `; + }, '')} + } + ` .trim() .replace(/[\r\n\s]+/g, ' '); + + this.plugin.app.workspace.trigger('css-change', { source: 'style-settings' }); } setConfig(settings: ParsedCSSSettings[]) { diff --git a/src/main.ts b/src/main.ts index a2b0c62..29e2c10 100644 --- a/src/main.ts +++ b/src/main.ts @@ -49,8 +49,10 @@ export default class CSSSettingsPlugin extends Plugin { }); this.registerEvent( - this.app.workspace.on('css-change', () => { - this.parseCSS(); + (this.app.workspace as any).on('css-change', (data?: { source: string }) => { + if (data?.source !== 'style-settings') { + this.parseCSS(); + } }) );