fix: resolve text preview error, add default panels

This commit is contained in:
2026-02-04 18:03:47 +05:00
parent d31e446fbd
commit bc7ed2498f
6 changed files with 105 additions and 63 deletions
+21 -1
View File
@@ -13,11 +13,31 @@
let backgroundImage = $state<string | undefined>(undefined);
onMount(async () => {
// Initialize with default texts for common Twitch panels
console.log("[INIT] Creating default texts...");
const defaultTexts = [
{ id: crypto.randomUUID(), text: "About" },
{ id: crypto.randomUUID(), text: "Links" },
];
texts = defaultTexts;
console.log("[INIT] Default texts created:", texts);
// Load background image
try {
backgroundImage = await imageService.loadDefaultBackground();
console.log("[INIT] Loading default background...");
const loadedBackground = await imageService.loadDefaultBackground();
console.log("[INIT] Background loaded:", loadedBackground);
backgroundImage = loadedBackground;
} catch (error) {
console.error("[INIT] Error loading background:", error);
exportService.setErrorMessage("Не удалось загрузить фоновое изображение по умолчанию");
}
// Create panels from texts (with or without background)
console.log("[INIT] Creating panels from texts...");
const initialPanels = panelService.updatePanelsFromTexts(texts, [], backgroundImage || "");
console.log("[INIT] Panels created:", initialPanels);
panels = initialPanels;
});
function handleImageUpload(image: string) {