Update editor, workspace, Git services, appearance, and project guides
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { APPEARANCE_KEY, applyAppearance, parseAppearance } from './appearance';
|
||||
import { CUSTOM_THEMES_KEY } from './customThemes';
|
||||
onMount(() => {
|
||||
const read = () => {
|
||||
try {
|
||||
const raw = localStorage.getItem(APPEARANCE_KEY);
|
||||
const appearance = parseAppearance(raw);
|
||||
const canonical = JSON.stringify(appearance);
|
||||
if (raw !== null && raw !== canonical) localStorage.setItem(APPEARANCE_KEY, canonical);
|
||||
applyAppearance(appearance);
|
||||
}
|
||||
catch { /* Keep the current appearance if storage is unavailable. */ }
|
||||
};
|
||||
const sync = (event: StorageEvent) => { if (event.key === APPEARANCE_KEY || event.key === CUSTOM_THEMES_KEY || event.key === null) read(); };
|
||||
read();
|
||||
window.addEventListener('storage', sync);
|
||||
window.addEventListener('focus', read);
|
||||
return () => { window.removeEventListener('storage', sync); window.removeEventListener('focus', read); };
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user