refactor: move

This commit is contained in:
Henry Li
2026-01-21 10:46:43 +08:00
parent 54d29e254f
commit 11c562eb98
2 changed files with 3 additions and 6 deletions

View File

@@ -16,7 +16,6 @@ import {
ArtifactHeader,
ArtifactTitle,
} from "@/components/ai-elements/artifact";
import { CodeEditor } from "@/components/ai-elements/code-editor";
import { Select, SelectItem } from "@/components/ui/select";
import {
SelectContent,
@@ -25,6 +24,7 @@ import {
SelectValue,
} from "@/components/ui/select";
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
import { CodeEditor } from "@/components/workspace/code-editor";
import { useArtifactContent } from "@/core/artifacts/hooks";
import { urlOfArtifact } from "@/core/artifacts/utils";
import { useI18n } from "@/core/i18n/hooks";

View File

@@ -48,10 +48,7 @@ export function CodeEditor({
autoFocus?: boolean;
settings?: any;
}) {
const { theme = "system", systemTheme = "light" } = useTheme();
const currentTheme =
theme === "system" ? systemTheme : (theme as "dark" | "light");
const { resolvedTheme } = useTheme();
const extensions = useMemo(() => {
return [
@@ -81,7 +78,7 @@ export function CodeEditor({
"h-full overflow-auto font-mono [&_.cm-editor]:h-full [&_.cm-focused]:outline-none!",
"px-2 py-0! [&_.cm-line]:px-2! [&_.cm-line]:py-0!",
)}
theme={currentTheme === "dark" ? customDarkTheme : customLightTheme}
theme={resolvedTheme === "dark" ? customDarkTheme : customLightTheme}
extensions={extensions}
basicSetup={{
foldGutter: settings?.foldGutter ?? false,