From b20821073fc40c20e84e3f3153cc5a043d09a467 Mon Sep 17 00:00:00 2001 From: Justineo Date: Thu, 25 Nov 2021 16:14:35 +0800 Subject: [PATCH] fix: fix color scheme switcher --- components/OneLive.vue | 3 ++- plugins/l10n.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/components/OneLive.vue b/components/OneLive.vue index 400d1ee..ce5e3f4 100644 --- a/components/OneLive.vue +++ b/components/OneLive.vue @@ -194,7 +194,7 @@ export default { return error.name ? `${error.name}: ${error.message}` : error.message }, colorScheme () { - if (!this.colorSchemeOption || !this.mql) { + if (!this.colorSchemeOption) { return 'dark' } @@ -253,6 +253,7 @@ export default { mounted () { this.mql = window.matchMedia('(prefers-color-scheme: dark)') this.mql.addEventListener('change', this.handleColorSchemeChange) + this.colorSchemeSystemPref = this.mql.matches ? 'dark' : 'light' }, beforeDestroy () { this.mql.removeEventListener('change', this.handleColorSchemeChange) diff --git a/plugins/l10n.js b/plugins/l10n.js index c3d42bd..f843086 100644 --- a/plugins/l10n.js +++ b/plugins/l10n.js @@ -19,7 +19,7 @@ i18n.register( { showCode: 'Show code', hideCode: 'Hide code', - expandEditor: 'Expand Live Editor', + expandEditor: 'Expand Live editor', playInCodeSandbox: 'Open in CodeSandbox', playInStackBlitz: 'Open in StackBlitz' },