From a6595c51db27dde3be6710e81ec372bc41dc3516 Mon Sep 17 00:00:00 2001 From: cfngc4594 Date: Thu, 20 Mar 2025 15:28:44 +0800 Subject: [PATCH] feat(format-button): switch to useProblemEditor hook for editor state --- .../playground/workspace/editor/components/format-button.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/features/playground/workspace/editor/components/format-button.tsx b/src/components/features/playground/workspace/editor/components/format-button.tsx index fc28bd7..5dd2f33 100644 --- a/src/components/features/playground/workspace/editor/components/format-button.tsx +++ b/src/components/features/playground/workspace/editor/components/format-button.tsx @@ -8,10 +8,10 @@ import { } from "@/components/ui/tooltip"; import { Paintbrush } from "lucide-react"; import { Button } from "@/components/ui/button"; -import { useCodeEditorStore } from "@/store/useCodeEditorStore"; +import { useProblemEditor } from "@/hooks/use-problem-editor"; export default function FormatButton() { - const { editor } = useCodeEditorStore(); + const { editor } = useProblemEditor(); return ( @@ -25,6 +25,7 @@ export default function FormatButton() { editor?.trigger("format", "editor.action.formatDocument", null); }} className="h-6 w-6 px-1.5 py-0.5 border-none shadow-none hover:bg-muted" + disabled={!editor} >