diff options
Diffstat (limited to 'apps/theming')
-rw-r--r-- | apps/theming/src/UserThemes.vue | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/apps/theming/src/UserThemes.vue b/apps/theming/src/UserThemes.vue index 5128e2c6c8d..ee514f049a5 100644 --- a/apps/theming/src/UserThemes.vue +++ b/apps/theming/src/UserThemes.vue @@ -100,13 +100,12 @@ export default { this.themes.forEach(theme => { if (theme.id === id && enabled) { theme.enabled = true - document.body.setAttribute(`data-theme-${theme.id}`, true) return } theme.enabled = false - document.body.removeAttribute(`data-theme-${theme.id}`) }) + this.updateBodyAttributes() this.selectItem(enabled, id) }, changeFont({ enabled, id }) { @@ -114,16 +113,24 @@ export default { this.fonts.forEach(font => { if (font.id === id && enabled) { font.enabled = true - document.body.setAttribute(`data-theme-${font.id}`, true) return } font.enabled = false - document.body.removeAttribute(`data-theme-${font.id}`) }) + this.updateBodyAttributes() this.selectItem(enabled, id) }, + updateBodyAttributes() { + const enabledThemesIDs = this.themes.filter(theme => theme.enabled === true).map(theme => theme.id) + this.themes.forEach(theme => { + document.body.toggleAttribute(`data-theme-${theme.id}`, theme.enabled) + }) + + document.body.setAttribute('data-themes', enabledThemesIDs.join(',')) + }, + /** * Commit a change and force reload css * Fetching the file again will trigger the server update |