diff --git a/frontend/src/lib/components/apps/editor/componentsPanel/ThemeList.svelte b/frontend/src/lib/components/apps/editor/componentsPanel/ThemeList.svelte index 1bd6f05d06..1a565def0a 100644 --- a/frontend/src/lib/components/apps/editor/componentsPanel/ThemeList.svelte +++ b/frontend/src/lib/components/apps/editor/componentsPanel/ThemeList.svelte @@ -144,6 +144,7 @@ on:reloadThemes={() => { getThemes() }} + on:setCodeTab /> {/key} {/each} diff --git a/frontend/src/lib/components/apps/editor/componentsPanel/ThemeRow.svelte b/frontend/src/lib/components/apps/editor/componentsPanel/ThemeRow.svelte index 6ef2047531..4b7d83bb13 100644 --- a/frontend/src/lib/components/apps/editor/componentsPanel/ThemeRow.svelte +++ b/frontend/src/lib/components/apps/editor/componentsPanel/ThemeRow.svelte @@ -6,7 +6,7 @@ import Cell from '$lib/components/table/Cell.svelte' import { Code, Eye, GitBranch, Pin, Save, Trash } from 'lucide-svelte' - import type { AppViewerContext } from '../../types' + import type { AppTheme, AppViewerContext } from '../../types' import { sendUserToast } from '$lib/toast' import Badge from '$lib/components/common/badge/Badge.svelte' import { twMerge } from 'tailwind-merge' @@ -103,13 +103,21 @@ $previewTheme = theme ?? '' } - async function fork() { + async function fork(path: string) { stopPreview() - const theme = await resolveTheme($app.theme, $workspaceStore) + + const theme: AppTheme = { + type: 'path', + path: path ?? '' + } + + const resolvedTheme = await resolveTheme(theme, $workspaceStore) + $app.theme = { type: 'inlined', - css: theme + css: resolvedTheme } + dispatch('setCodeTab') } @@ -177,7 +185,7 @@ View code - + fork(row.path)}>