File tree Expand file tree Collapse file tree 2 files changed +11
-13
lines changed Expand file tree Collapse file tree 2 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -178,7 +178,7 @@ const selectedTheme = ref('neon-bunny');
178
178
179
179
180
180
onBeforeMount (() => {
181
- library .value = store .getLocalStorage () ?? store .setLocalStorage ();
181
+ library .value = store .getLocalStorage () ?? store .setLocalStorage (' prism ' );
182
182
changeLibrary (library .value );
183
183
});
184
184
Original file line number Diff line number Diff line change 24
24
<fa-icon icon =" fa-solid fa-house" />
25
25
</a >
26
26
</li >
27
- <li class =" nav-item dropdown" >
27
+ <li v-if = " !isPlayground " class =" nav-item dropdown" >
28
28
<a
29
29
id =" docs-dropdown"
30
30
aria-expanded =" false"
86
86
</li >
87
87
88
88
<!-- Examples -->
89
- <li class =" nav-item dropdown" >
89
+ <li v-if = " !isPlayground " class =" nav-item dropdown" >
90
90
<a
91
91
id =" examples-dropdown"
92
92
aria-expanded =" false"
182
182
183
183
<script setup>
184
184
import { inject , ref } from ' vue' ;
185
+ import { useCoreStore } from ' @/stores/index' ;
185
186
186
187
defineProps ({
188
+ isPlayground: {
189
+ type: Boolean ,
190
+ default: false ,
191
+ },
187
192
selectedLibrary: {
188
193
type: Object ,
189
194
required: true ,
190
- }
195
+ },
191
196
});
192
197
193
198
const links = inject (' links' );
194
199
const prismLinks = inject (' prismLinks' );
195
200
const highlightJsLinks = inject (' highlightJsLinks' );
196
201
202
+ const store = useCoreStore ();
197
203
const storedTheme = localStorage .getItem (' theme' );
198
204
const pageTheme = ref (storedTheme);
199
205
@@ -206,15 +212,7 @@ const getPreferredTheme = () => {
206
212
};
207
213
208
214
const setTheme = function (theme ) {
209
- if (theme === ' toggle' ) {
210
- pageTheme .value = pageTheme .value !== ' dark' ? ' dark' : ' light' ;
211
- }
212
- else {
213
- pageTheme .value = theme;
214
- }
215
-
216
- document .documentElement .setAttribute (' data-bs-theme' , pageTheme .value );
217
- localStorage .setItem (' theme' , pageTheme .value );
215
+ pageTheme .value = store .setTheme (theme, pageTheme .value );
218
216
};
219
217
220
218
setTheme (getPreferredTheme ());
You can’t perform that action at this time.
0 commit comments