|
26 | 26 | :id="theme"
|
27 | 27 | :key="theme"
|
28 | 28 | class="theme"
|
29 |
| - :class=" |
30 |
| - theme == selectedTheme ? 'selected set' : '' |
31 |
| - " |
| 29 | + :class="{ |
| 30 | + selected: theme === selectedTheme, |
| 31 | + set: theme === selectedThemeRef |
| 32 | + }" |
32 | 33 | >
|
33 | 34 | <div
|
34 | 35 | class="themeSel"
|
@@ -161,6 +162,7 @@ const customThemes = ref<((keyof typeof customThemesList)[]) | undefined>(undefi
|
161 | 162 | const customThemesList: Themes = reactive({})
|
162 | 163 | const selectedTheme = ref('default-theme')
|
163 | 164 | const iscustomTheme = ref(false)
|
| 165 | +const selectedThemeRef = ref<string | null>(null) |
164 | 166 |
|
165 | 167 | onMounted(() => {
|
166 | 168 | SimulatorState.dialogBox.theme_dialog = false
|
@@ -195,36 +197,32 @@ function changeCustomTheme(e: InputEvent) {
|
195 | 197 |
|
196 | 198 | function applyTheme() {
|
197 | 199 | if (iscustomTheme.value == false) {
|
198 |
| - if ($('.selected label').text()) { |
| 200 | + if (selectedTheme.value) { |
199 | 201 | localStorage.removeItem('Custom Theme')
|
200 |
| - localStorage.setItem('theme', $('.selected label').text()) |
| 202 | + localStorage.setItem('theme', selectedTheme.value) |
201 | 203 | }
|
202 | 204 | } else {
|
203 |
| - // update theme to Custom Theme |
204 | 205 | localStorage.setItem('theme', 'Custom Theme')
|
205 |
| - // add Custom theme to custom theme object |
206 | 206 | localStorage.setItem(
|
207 | 207 | 'Custom Theme',
|
208 | 208 | JSON.stringify(themeOptions['Custom Theme'])
|
209 | 209 | )
|
210 | 210 | }
|
211 |
| - $('.set').removeClass('set') |
212 |
| - $('.selected').addClass('set') |
| 211 | + selectedThemeRef.value = selectedTheme.value |
213 | 212 | SimulatorState.dialogBox.theme_dialog = false
|
214 | 213 | setTimeout(() => (iscustomTheme.value = false), 1000)
|
215 | 214 | }
|
| 215 | +
|
216 | 216 | function applyCustomTheme() {
|
217 | 217 | iscustomTheme.value = true
|
218 | 218 | updateThemeForStyle(localStorage.getItem('theme'))
|
219 | 219 | updateBG()
|
220 | 220 | localStorage.setItem('theme', 'Custom Theme')
|
221 |
| - // add Custom theme to custom theme object |
222 | 221 | localStorage.setItem(
|
223 | 222 | 'Custom Theme',
|
224 | 223 | JSON.stringify(themeOptions['Custom Theme'])
|
225 | 224 | )
|
226 |
| - $('.set').removeClass('set') |
227 |
| - $('.selected').addClass('set') |
| 225 | + selectedThemeRef.value = selectedTheme.value |
228 | 226 | }
|
229 | 227 |
|
230 | 228 | function receivedText(e: ProgressEvent<FileReader>) {
|
|
0 commit comments