hopefully fixing issues

This commit is contained in:
2026-01-22 10:44:59 +01:00
parent 8a2f05de71
commit aa550c96b7
14 changed files with 545 additions and 417 deletions

View File

@@ -1,6 +1,6 @@
<script lang="ts">
import { Code, Palette, X, Globe, Layers } from 'lucide-svelte';
import { onMount, onDestroy } from 'svelte';
import { onMount, onDestroy, tick } from 'svelte';
import { EditorState, Compartment } from '@codemirror/state';
import { EditorView, keymap } from '@codemirror/view';
import { html } from '@codemirror/lang-html';
@@ -40,10 +40,10 @@
editMode = modes[(idx + 1) % modes.length];
}
let htmlContainer = $state<HTMLDivElement>(undefined!);
let cssContainer = $state<HTMLDivElement>(undefined!);
let sharedContainer = $state<HTMLDivElement>(undefined!);
let appContainer = $state<HTMLDivElement>(undefined!);
let htmlContainer: HTMLDivElement | null = $state(null);
let cssContainer: HTMLDivElement | null = $state(null);
let sharedContainer: HTMLDivElement | null = $state(null);
let appContainer: HTMLDivElement | null = $state(null);
let htmlEditor: EditorView | null = null;
let cssEditor: EditorView | null = null;
@@ -136,13 +136,13 @@
const currentAppCss = appState.manifest.appCss;
if (currentAppCss !== previousAppCss) {
previousAppCss = currentAppCss;
setTimeout(() => {
tick().then(() => {
const newTheme = createTheme();
htmlEditor?.dispatch({ effects: themeCompartment.reconfigure(newTheme) });
cssEditor?.dispatch({ effects: themeCompartment.reconfigure(newTheme) });
sharedEditor?.dispatch({ effects: themeCompartment.reconfigure(newTheme) });
appEditor?.dispatch({ effects: themeCompartment.reconfigure(newTheme) });
}, 50);
});
}
});